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 12:14:48 +0100
commitbe3e5649770c846e00f9be37e1c29918d4078c72 (patch)
treed7e5180b1aae789a6d2bcdba156930cab71ca8dc /sound
parentefe8f55ce9ade497b60ebb71d79e0d9b5a66b45f (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 f652e90efd7e..5ddf81f091fa 100644
--- a/sound/core/jack.c
+++ b/sound/core/jack.c
@@ -234,6 +234,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) {