ALSA: usb-audio: Add sanity checks for endpoint accesses
authorTakashi Iwai <tiwai@suse.de>
Tue, 15 Mar 2016 14:20:58 +0000 (15:20 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Sat, 30 Apr 2016 22:05:18 +0000 (00:05 +0200)
commitc0e9921c951610c287650bf70495d7ccac8bee7f
tree358bdbd27dbb06257c9772c7f318839e34249546
parent8e5c3482b5c7bcbd7df6b10ddb6d7bcc578f3553
ALSA: usb-audio: Add sanity checks for endpoint accesses

commit 447d6275f0c21f6cc97a88b3a0c601436a4cdf2a upstream.

Add some sanity check codes before actually accessing the endpoint via
get_endpoint() in order to avoid the invalid access through a
malformed USB descriptor.  Mostly just checking bNumEndpoints, but in
one place (snd_microii_spdif_default_get()), the validity of iface and
altsetting index is checked as well.

Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=971125
Signed-off-by: Takashi Iwai <tiwai@suse.de>
[bwh: Backported to 3.2: drop changes to code we don't have]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
sound/usb/clock.c
sound/usb/pcm.c