提交 00fe7c0f 编写于 作者: X Xiaoke Wang 提交者: Zheng Zengkai

ALSA: jack: Check the return value of kstrdup()

stable inclusion
from stable-v5.10.89
commit a96c08e0b41e022b440ee9c8327b14dd6eb094f7
bugzilla: 186140 https://gitee.com/openeuler/kernel/issues/I4S8HA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=a96c08e0b41e022b440ee9c8327b14dd6eb094f7

--------------------------------

commit c01c1db1 upstream.

kstrdup() can return NULL, it is better to check the return value of it.
Signed-off-by: NXiaoke Wang <xkernel.wang@foxmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/tencent_094816F3522E0DC704056C789352EBBF0606@qq.comSigned-off-by: NTakashi Iwai <tiwai@suse.de>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 21af7b26
...@@ -220,6 +220,10 @@ int snd_jack_new(struct snd_card *card, const char *id, int type, ...@@ -220,6 +220,10 @@ int snd_jack_new(struct snd_card *card, const char *id, int type,
return -ENOMEM; return -ENOMEM;
jack->id = kstrdup(id, GFP_KERNEL); jack->id = kstrdup(id, GFP_KERNEL);
if (jack->id == NULL) {
kfree(jack);
return -ENOMEM;
}
/* don't creat input device for phantom jack */ /* don't creat input device for phantom jack */
if (!phantom_jack) { if (!phantom_jack) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册