summaryrefslogtreecommitdiff
path: root/sound/core/jack.c
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:23:36 +0100
commitfdaf41977d7747ca914e91c85665df009b456a08 (patch)
tree2f86028e68071788cd4728cd82f558979aaa0764 /sound/core/jack.c
parent44c743f63dd3e92f1bfb2b43c0374406bc60213f (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/core/jack.c')
-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 fb26196571a7..8b209750c7a9 100644
--- a/sound/core/jack.c
+++ b/sound/core/jack.c
@@ -220,6 +220,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) {