diff options
author | Takashi Iwai <tiwai@suse.de> | 2016-03-15 15:20:58 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2016-03-16 12:45:32 +0100 |
commit | 447d6275f0c21f6cc97a88b3a0c601436a4cdf2a (patch) | |
tree | e2249232cdd129840ef943a3b2136a2205065f25 /sound/usb/pcm.c | |
parent | ALSA: usb-audio: Minor code cleanup in create_fixed_stream_quirk() (diff) | |
download | linux-447d6275f0c21f6cc97a88b3a0c601436a4cdf2a.tar.xz linux-447d6275f0c21f6cc97a88b3a0c601436a4cdf2a.zip |
ALSA: usb-audio: Add sanity checks for endpoint accesses
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
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/pcm.c')
-rw-r--r-- | sound/usb/pcm.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c index 9245f52d43bd..44d178ee9177 100644 --- a/sound/usb/pcm.c +++ b/sound/usb/pcm.c @@ -159,6 +159,8 @@ static int init_pitch_v1(struct snd_usb_audio *chip, int iface, unsigned char data[1]; int err; + if (get_iface_desc(alts)->bNumEndpoints < 1) + return -EINVAL; ep = get_endpoint(alts, 0)->bEndpointAddress; data[0] = 1; |