From 35c302aa754d9d1c225e216c918370190f27aabd Mon Sep 17 00:00:00 2001 From: Su Hui Date: Tue, 28 Oct 2025 14:59:59 +0800 Subject: [PATCH] ALSA: ac97: Fix possible NULL dereference in snd_ac97_mixer stable inclusion from stable-v4.19.291 commit e4cccff1e7ab6ea30995b6fbbb007d02647e025c category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/ID0VHK CVE: CVE-2023-53648 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=e4cccff1e7ab6ea30995b6fbbb007d02647e025c -------------------------------- [ Upstream commit 79597c8bf64ca99eab385115743131d260339da5 ] smatch error: sound/pci/ac97/ac97_codec.c:2354 snd_ac97_mixer() error: we previously assumed 'rac97' could be null (see line 2072) remove redundant assignment, return error if rac97 is NULL. Fixes: da3cec35dd3c ("ALSA: Kill snd_assert() in sound/pci/*") Signed-off-by: Su Hui Link: https://lore.kernel.org/r/20230615021732.1972194-1-suhui@nfschina.com Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Signed-off-by: Yuan Can --- sound/pci/ac97/ac97_codec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index fee9ffecd584..202f8bc0a78a 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c @@ -2026,8 +2026,8 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template, .dev_disconnect = snd_ac97_dev_disconnect, }; - if (rac97) - *rac97 = NULL; + if (!rac97) + return -EINVAL; if (snd_BUG_ON(!bus || !template)) return -EINVAL; if (snd_BUG_ON(template->num >= 4)) -- Gitee