Skip to contentSkip to conversation

ALSA: usb-audio: Fix NULL dereference at parsing BADD

PATCH New Takashi Iwai 1 participant 1 message Nov 22, 2019 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: usb-audio: Fix NULL dereference at parsing BADD

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 [email protected]
---
 sound/usb/mixer.c | 3 +++
 1 file changed, 3 insertions(+)
sound/usb/mixer.c +3 -0
index 45eee5cc312e..6cd4ff09c5ee 100644
@@ -2930,6 +2930,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)
Signature · 6 lines
2.16.4

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel