projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
28b03ec
)
ALSA: jack: Check the return value of kstrdup()
author
Xiaoke Wang
<xkernel.wang@foxmail.com>
Mon, 13 Dec 2021 07:39:31 +0000
(15:39 +0800)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Wed, 29 Dec 2021 11:28:50 +0000
(12:28 +0100)
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>
sound/core/jack.c
patch
|
blob
|
history
diff --git
a/sound/core/jack.c
b/sound/core/jack.c
index 32350c6aba849d41af1586a0583f6b1f87b51d35..537df1e98f8acf6c6cf7dd04651046e02332187f 100644
(file)
--- a/
sound/core/jack.c
+++ b/
sound/core/jack.c
@@
-509,6
+509,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) {