summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorXiaoke Wang <xkernel.wang@foxmail.com>2021-12-13 15:39:31 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-12-29 11:50:30 +0100
commit29533bbddd799352b2c9ad0568533e536d1baaec (patch)
tree4dc6182a1d43d49e7773705e7145de21c7d12bcb /sound
parentf20c86f5d161f9a75b12530caa4590c0cf9536cd (diff)
ALSA: jack: Check the return value of kstrdup()
commit c01c1db1dc632edafb0dff32d40daf4f9c1a4e19 upstream. kstrdup() can return NULL, it is better to check the return value of it. Signed-off-by: Xiaoke Wang <xkernel.wang@foxmail.com> Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/tencent_094816F3522E0DC704056C789352EBBF0606@qq.com Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/core/jack.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sound/core/jack.c b/sound/core/jack.c
index 7237acbdcbbc..fcc972fbe8ff 100644
--- a/sound/core/jack.c
+++ b/sound/core/jack.c
@@ -227,6 +227,10 @@ int snd_jack_new(struct snd_card *card, const char *id, int type,
return -ENOMEM;
jack->id = kstrdup(id, GFP_KERNEL);
+ if (jack->id == NULL) {
+ kfree(jack);
+ return -ENOMEM;
+ }
/* don't creat input device for phantom jack */
if (!phantom_jack) {