From: Roman Demidov <roman.demidov.nn@gmail.com>
To: stable@vger.kernel.org, Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Roman Demidov <roman.demidov.nn@gmail.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Sasha Levin <sashal@kernel.org>,
Tim Guttzeit <t.guttzeit@tuxedocomputers.com>,
Werner Sembach <wse@tuxedocomputers.com>,
Kailang Yang <kailang@realtek.com>,
Zhang Heng <zhangheng@kylinos.cn>,
Sean Rhodes <sean@starlabs.systems>,
Damien Dagorn <damien.dagorn29@gmail.com>,
Martin Hamilton <m@martinh.net>,
Bharat Dev Burman <bharat.singh7924@gmail.com>,
Lei Huang <huanglei@kylinos.cn>,
Stefan Binding <sbinding@opensource.cirrus.com>,
Lucas Tanure <tanureal@opensource.cirrus.com>,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
Denis Arefev <arefev@swemel.ru>, Takashi Iwai <tiwai@suse.de>
Subject: [PATCH 6.1] ALSA: hda: Fix missing pointer check in hda_component_manager_init function
Date: Mon, 14 Sep 2026 11:05:45 +0300 [thread overview]
Message-ID: <20260914080546.11947-1-roman.demidov.nn@gmail.com> (raw)
From: Denis Arefev <arefev@swemel.ru>
commit 1cf11d80db5df805b538c942269e05a65bcaf5bc upstream.
The __component_match_add function may assign the 'matchptr' pointer
the value ERR_PTR(-ENOMEM), which will subsequently be dereferenced.
The call stack leading to the error looks like this:
hda_component_manager_init
|-> component_match_add
|-> component_match_add_release
|-> __component_match_add ( ... ,**matchptr, ... )
|-> *matchptr = ERR_PTR(-ENOMEM); // assign
|-> component_master_add_with_match( ... match)
|-> component_match_realloc(match, match->num); // dereference
Add IS_ERR() check to prevent the crash.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: ae7abe36e352 ("ALSA: hda/realtek: Add CS35L41 support for Thinkpad laptops")
Cc: stable@vger.kernel.org
Signed-off-by: Denis Arefev <arefev@swemel.ru>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
[Roman: Instead of modifying hda_component_manager_init() (which does not
yet exist in version 6.1), a check needs to be added to the
cs35l41_generic_fixup() function—the very function introduced by the
offending commit, which calls component_match_add() without verifying its
successful completion.]
Signed-off-by: Roman Demidov <roman.demidov.nn@gmail.com>
---
Backport fix for BDU:2026-03984
sound/pci/hda/patch_realtek.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 7b4fd95c66f9..9e6846a37d67 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -7021,6 +7021,11 @@ static void cs35l41_generic_fixup(struct hda_codec *cdc, int action, const char
spec->comps[i].codec = cdc;
component_match_add(dev, &spec->match,
comp_match_cs35l41_dev_name, rec);
+ if (IS_ERR(spec->match)) {
+ codec_err(cdc, "Fail to add component %ld\n",
+ PTR_ERR(spec->match));
+ return;
+ }
}
ret = component_master_add_with_match(dev, &comp_master_ops, spec->match);
if (ret)
--
2.53.0
next reply other threads:[~2026-09-14 8:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-14 8:05 Roman Demidov [this message]
2026-09-15 2:03 ` Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260914080546.11947-1-roman.demidov.nn@gmail.com \
--to=roman.demidov.nn@gmail.com \
--cc=arefev@swemel.ru \
--cc=bharat.singh7924@gmail.com \
--cc=damien.dagorn29@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=huanglei@kylinos.cn \
--cc=kailang@realtek.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=m@martinh.net \
--cc=perex@perex.cz \
--cc=sashal@kernel.org \
--cc=sbinding@opensource.cirrus.com \
--cc=sean@starlabs.systems \
--cc=stable@vger.kernel.org \
--cc=t.guttzeit@tuxedocomputers.com \
--cc=tanureal@opensource.cirrus.com \
--cc=tiwai@suse.com \
--cc=tiwai@suse.de \
--cc=wse@tuxedocomputers.com \
--cc=zhangheng@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®