linux/sound/pci/ymfpci
Zhao Dongdong e64d170346 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: c9b83ae4a1 ("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>
2026-05-28 09:36:09 +02:00
..
Makefile ALSA: pci: Use *-y instead of *-objs in Makefile 2024-05-08 18:17:37 +02:00
ymfpci_main.c ALSA: ymfpci: check snd_ctl_new1() return value 2026-05-28 09:36:09 +02:00
ymfpci.c ALSA: Consistently define pci_device_ids using named initializers 2026-05-04 13:22:14 +02:00
ymfpci.h ALSA: ymfpci: Use u16 consistently for old_legacy_ctrl 2023-03-29 08:28:47 +02:00