Commit d7c71df
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 5b31fe7 commit d7c71df
1 file changed
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1827 | 1827 | | |
1828 | 1828 | | |
1829 | 1829 | | |
| 1830 | + | |
| 1831 | + | |
1830 | 1832 | | |
1831 | 1833 | | |
1832 | 1834 | | |
1833 | 1835 | | |
1834 | 1836 | | |
| 1837 | + | |
| 1838 | + | |
1835 | 1839 | | |
1836 | 1840 | | |
1837 | 1841 | | |
1838 | 1842 | | |
1839 | 1843 | | |
| 1844 | + | |
| 1845 | + | |
1840 | 1846 | | |
1841 | 1847 | | |
1842 | 1848 | | |
| |||
0 commit comments