summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhao Dongdong <zhaodongdong@kylinos.cn>2026-05-27 15:09:09 +0300
committerTakashi Iwai <tiwai@suse.de>2026-05-28 10:34:41 +0300
commit1edd1f02dddd20aeb6066ded41017615766ea42f (patch)
treef1c8375b072ecfb91e5e25320b0f01f43f0238b0
parent958e4450e961d75bd9d8f5bfe245fb15bc78e02a (diff)
downloadlinux-1edd1f02dddd20aeb6066ded41017615766ea42f.tar.xz
ALSA: es1938: check snd_ctl_new1() return value
snd_ctl_new1() can return NULL when memory allocation fails. snd_es1938_mixer() does not check the return value before dereferencing the pointer, which can lead to a NULL pointer dereference. Add a NULL check after snd_ctl_new1() and return -ENOMEM if it fails. Assisted-by: Opencode:DeepSeek-V4-Flash Cc: stable@vger.kernel.org Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Zhao Dongdong <zhaodongdong@kylinos.cn> Link: https://patch.msgid.link/tencent_E0DC65165FDF2C8982BAFB6794B854B53B0A@qq.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/es1938.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c
index f4c7a9532f4a..217beb9376ac 100644
--- a/sound/pci/es1938.c
+++ b/sound/pci/es1938.c
@@ -1655,6 +1655,8 @@ static int snd_es1938_mixer(struct es1938 *chip)
for (idx = 0; idx < ARRAY_SIZE(snd_es1938_controls); idx++) {
struct snd_kcontrol *kctl;
kctl = snd_ctl_new1(&snd_es1938_controls[idx], chip);
+ if (!kctl)
+ return -ENOMEM;
switch (idx) {
case 0:
chip->master_volume = kctl;