summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-11-22 14:28:40 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-12-01 11:17:38 +0300
commit3510fb7947d5a7ca662178efe4f8d3712bb85177 (patch)
tree427b98733ea4737528e6ab099399eef252719e8d /sound
parent2819f4030f43057238992a4adcd950d7c95aff65 (diff)
downloadlinux-3510fb7947d5a7ca662178efe4f8d3712bb85177.tar.xz
ALSA: usb-audio: Fix NULL dereference at parsing BADD
commit 9435f2bb66874a0c4dd25e7c978957a7ca2c93b1 upstream. snd_usb_mixer_controls_badd() that parses UAC3 BADD profiles misses a NULL check for the given interfaces. When a malformed USB descriptor is passed, this may lead to an Oops, as spotted by syzkaller. Skip the iteration if the interface doesn't exist for avoiding the crash. Fixes: 17156f23e93c ("ALSA: usb: add UAC3 BADD profiles support") Reported-by: syzbot+a36ab65c6653d7ccdd62@syzkaller.appspotmail.com Suggested-by: Dan Carpenter <dan.carpenter@oracle.com> Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20191122112840.24797-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/usb/mixer.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index 726cbd63a0c7..d7778f2bcbf8 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -2949,6 +2949,9 @@ static int snd_usb_mixer_controls_badd(struct usb_mixer_interface *mixer,
continue;
iface = usb_ifnum_to_if(dev, intf);
+ if (!iface)
+ continue;
+
num = iface->num_altsetting;
if (num < 2)