From: Takashi Iwai <tiwai@suse.de>
To: Roel Kluin <roel.kluin@gmail.com>
Cc: Jaroslav Kysela <perex@perex.cz>,
alsa-devel@alsa-project.org,
Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ALSA: possible read past array alc88[02]_parse_auto_config()
Date: Wed, 11 Nov 2009 08:08:33 +0100 [thread overview]
Message-ID: <s5hskcl5yj2.wl%tiwai@suse.de> (raw)
In-Reply-To: <4AF9BAFB.3090403@gmail.com>
At Tue, 10 Nov 2009 20:11:55 +0100,
Roel Kluin wrote:
>
> The test of index `i' is after the read - too late - and
> unsafe: if snd_hda_get_connections() fails in the last
> iteration a read beyond the array is possible.
>
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Applied now. Thanks!
Takashi
> ---
> sound/pci/hda/patch_realtek.c | 8 ++++----
> 1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
> index ff20048..fd094f5 100644
> --- a/sound/pci/hda/patch_realtek.c
> +++ b/sound/pci/hda/patch_realtek.c
> @@ -4684,9 +4684,9 @@ static int alc880_parse_auto_config(struct hda_codec *codec)
> spec->multiout.dig_out_nid = dig_nid;
> else {
> spec->multiout.slave_dig_outs = spec->slave_dig_outs;
> - spec->slave_dig_outs[i - 1] = dig_nid;
> - if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
> + if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
> break;
> + spec->slave_dig_outs[i - 1] = dig_nid;
> }
> }
> if (spec->autocfg.dig_in_pin)
> @@ -9813,9 +9813,9 @@ static int alc882_parse_auto_config(struct hda_codec *codec)
> spec->multiout.dig_out_nid = dig_nid;
> else {
> spec->multiout.slave_dig_outs = spec->slave_dig_outs;
> - spec->slave_dig_outs[i - 1] = dig_nid;
> - if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
> + if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
> break;
> + spec->slave_dig_outs[i - 1] = dig_nid;
> }
> }
> if (spec->autocfg.dig_in_pin)
>
prev parent reply other threads:[~2009-11-11 7:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-10 19:11 Roel Kluin
2009-11-11 7:08 ` 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=s5hskcl5yj2.wl%tiwai@suse.de \
--to=tiwai@suse.de \
--cc=akpm@linux-foundation.org \
--cc=alsa-devel@alsa-project.org \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=roel.kluin@gmail.com \
/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®