Commit 9109547
ALSA: ymfpci: check snd_ctl_new1() return value
commit e64d170 upstream.
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: c9b83ae ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent c31679f commit 9109547
1 file changed
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1822 | 1822 | | |
1823 | 1823 | | |
1824 | 1824 | | |
| 1825 | + | |
| 1826 | + | |
1825 | 1827 | | |
1826 | 1828 | | |
1827 | 1829 | | |
1828 | 1830 | | |
1829 | 1831 | | |
| 1832 | + | |
| 1833 | + | |
1830 | 1834 | | |
1831 | 1835 | | |
1832 | 1836 | | |
1833 | 1837 | | |
1834 | 1838 | | |
| 1839 | + | |
| 1840 | + | |
1835 | 1841 | | |
1836 | 1842 | | |
1837 | 1843 | | |
| |||
0 commit comments