From: Takashi Iwai <tiwai@suse.de>
To: wangdich9700@163.com
Cc: tiwai@suse.com, broonie@kernel.org, linux-sound@vger.kernel.org,
linux-kernel@vger.kernel.org, wangdicheng@kylinos.cn
Subject: Re: [PATCH 1/2] ALSA: hda/conexant: Fix EAPD pin array overflow
Date: Wed, 29 Jul 2026 09:33:09 +0200 [thread overview]
Message-ID: <87fr125jyi.wl-tiwai@suse.de> (raw)
In-Reply-To: <20260729070935.548050-1-wangdich9700@163.com>
On Wed, 29 Jul 2026 09:09:34 +0200,
wangdich9700@163.com wrote:
>
> 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.
No, it checks right after the increment, then aborts the loop. So any
overwrite won't happen.
Takashi
>
> 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
>
prev parent reply other threads:[~2026-07-29 7:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-29 7:09 [PATCH 1/2] ALSA: hda/conexant: Fix EAPD pin array overflow wangdich9700
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 ` Takashi Iwai [this message]
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=87fr125jyi.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=tiwai@suse.com \
--cc=wangdich9700@163.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