From: wangdich9700@163.com
To: tiwai@suse.com, broonie@kernel.org, wangdich9700@163.com
Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
wangdicheng@kylinos.cn
Subject: [PATCH 1/2] ALSA: hda/conexant: Fix EAPD pin array overflow
Date: Wed, 29 Jul 2026 15:09:34 +0800 [thread overview]
Message-ID: <20260729070935.548050-1-wangdich9700@163.com> (raw)
From: wangdicheng <wangdicheng@kylinos.cn>
The bounds check in cx_auto_parse_eapd() happens after the write,
so when a codec has more than 4 EAPD pins the 5th one gets written
to eapds[4] which is past the end of the array and clobbers the
adjacent dynamic_eapd field.
Swap the check and the write.
Signed-off-by: wangdicheng <wangdicheng@kylinos.cn>
---
sound/hda/codecs/conexant.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/hda/codecs/conexant.c b/sound/hda/codecs/conexant.c
index 40da2832ba66..e7a2a073d22c 100644
--- a/sound/hda/codecs/conexant.c
+++ b/sound/hda/codecs/conexant.c
@@ -100,9 +100,9 @@ static void cx_auto_parse_eapd(struct hda_codec *codec)
continue;
if (!(snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD))
continue;
- spec->eapds[spec->num_eapds++] = nid;
if (spec->num_eapds >= ARRAY_SIZE(spec->eapds))
break;
+ spec->eapds[spec->num_eapds++] = nid;
}
/* NOTE: below is a wild guess; if we have more than two EAPDs,
--
2.25.1
next reply other threads:[~2026-07-29 7:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-29 7:09 wangdich9700 [this message]
2026-07-29 7:09 ` [PATCH 2/2] ALSA: hda/conexant: Add NULL check for dc_mode_path wangdich9700
2026-07-29 7:48 ` Takashi Iwai
2026-07-29 7:33 ` [PATCH 1/2] ALSA: hda/conexant: Fix EAPD pin array overflow Takashi Iwai
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=20260729070935.548050-1-wangdich9700@163.com \
--to=wangdich9700@163.com \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=tiwai@suse.com \
--cc=wangdicheng@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®