Skip to content

Commit

Permalink
ALSA: usb-audio: fix sync-ep altsetting sanity check
Browse files Browse the repository at this point in the history
commit 5d1b712 upstream

The altsetting sanity check in set_sync_ep_implicit_fb_quirk() was
checking for there to be at least one altsetting but then went on to
access the second one, which may not exist.

This could lead to random slab data being used to initialise the sync
endpoint in snd_usb_add_endpoint().

Fixes: c75a8a7 ("ALSA: snd-usb: add support for implicit feedback")
Fixes: ca10a7e ("ALSA: usb-audio: FT C400 sync playback EP to capture EP")
Fixes: 5e35dc0 ("ALSA: usb-audio: add implicit fb quirk for Behringer UFX1204")
Fixes: 17f08b0 ("ALSA: usb-audio: add implicit fb quirk for Axe-Fx II")
Fixes: 103e962 ("ALSA: usb-audio: simplify set_sync_ep_implicit_fb_quirk")
Cc: stable <stable@vger.kernel.org>     # 3.5
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20200114083953.1106-1-johan@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Johan Hovold authored and Greg Kroah-Hartman committed Jan 9, 2021
1 parent 832cf72 commit f8181d3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sound/usb/pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs,
add_sync_ep_from_ifnum:
iface = usb_ifnum_to_if(dev, ifnum);

if (!iface || iface->num_altsetting == 0)
if (!iface || iface->num_altsetting < 2)
return -EINVAL;

alts = &iface->altsetting[1];
Expand Down

0 comments on commit f8181d3

Please sign in to comment.