]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ALSA: ymfpci: check snd_ctl_new1() return value
authorZhao Dongdong <zhaodongdong@kylinos.cn>
Wed, 27 May 2026 12:09:12 +0000 (20:09 +0800)
committerTakashi Iwai <tiwai@suse.de>
Thu, 28 May 2026 07:36:09 +0000 (09:36 +0200)
commite64d170346d00b580c0043de3e5ccb3e331c47d4
treeed9211dd080c1d997cf16347c1811f3633662e01
parent2b929b91b0f3bc6de8a844370049cd99ee8e31ff
ALSA: ymfpci: check snd_ctl_new1() return value

snd_ctl_new1() can return NULL when memory allocation fails.
snd_ymfpci_create_spdif_controls() does not check the return value
before dereferencing kctl->id.device, which can lead to a NULL pointer
dereference.

Add NULL checks after snd_ctl_new1() calls and return -ENOMEM if any
fails.

Assisted-by: Opencode:DeepSeek-V4-Flash
Cc: stable@vger.kernel.org
Fixes: c9b83ae4a160 ("ALSA: ymfpci: Fix kctl->id initialization")
Signed-off-by: Zhao Dongdong <zhaodongdong@kylinos.cn>
Link: https://patch.msgid.link/tencent_4745C5DC2333325C0EDAB1EFC88A136E6809@qq.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/ymfpci/ymfpci_main.c