From: Takashi Iwai <tiwai@suse.de>
To: Johan Hovold <johan@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
stable <stable@vger.kernel.org>
Subject: Re: [PATCH] ALSA: usb-audio: fix set_format altsetting sanity check
Date: Fri, 20 Dec 2019 10:46:50 +0100 [thread overview]
Message-ID: <s5hbls35nxx.wl-tiwai@suse.de> (raw)
In-Reply-To: <20191220093134.1248-1-johan@kernel.org>
On Fri, 20 Dec 2019 10:31:34 +0100,
Johan Hovold wrote:
>
> Make sure to check the return value of usb_altnum_to_altsetting() to
> avoid dereferencing a NULL pointer when the requested alternate settings
> is missing.
>
> The format altsetting number may come from a quirk table and there does
> not seem to be any other validation of it (the corresponding index is
> checked however).
>
> Fixes: b099b9693d23 ("ALSA: usb-audio: Avoid superfluous usb_set_interface() calls")
> Cc: stable <stable@vger.kernel.org> # 4.18
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
> sound/usb/pcm.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
> index 9c8930bb00c8..73dd9d21bb42 100644
> --- a/sound/usb/pcm.c
> +++ b/sound/usb/pcm.c
> @@ -506,9 +506,9 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt)
> if (WARN_ON(!iface))
> return -EINVAL;
> alts = usb_altnum_to_altsetting(iface, fmt->altsetting);
> - altsd = get_iface_desc(alts);
> - if (WARN_ON(altsd->bAlternateSetting != fmt->altsetting))
> + if (WARN_ON(!alts))
> return -EINVAL;
Do we need WARN_ON() here? If this may hit on syzbot, it'll stop at
this point because of panic_on_warn.
thanks,
Takashi
> + altsd = get_iface_desc(alts);
>
> if (fmt == subs->cur_audiofmt)
> return 0;
> --
> 2.24.1
>
next prev parent reply other threads:[~2019-12-20 9:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-20 9:31 [PATCH] ALSA: usb-audio: fix set_format altsetting sanity check Johan Hovold
2019-12-20 9:46 ` Takashi Iwai [this message]
2019-12-20 10:23 ` Johan Hovold
2019-12-20 10:32 ` 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=s5hbls35nxx.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=stable@vger.kernel.org \
/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