diff options
author | Takashi Iwai <tiwai@suse.de> | 2016-03-15 15:20:58 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-04-12 09:12:42 -0700 |
commit | 70e1a065eb16bae77c8bce1ae282c76f33ef65dd (patch) | |
tree | 2e2c6810483ca402fcfe7173251fc39d2192a0de /sound/usb/endpoint.c | |
parent | 7963d34edc58f8e40c0891262cac6e443346313f (diff) |
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'sound/usb/endpoint.c')
-rw-r--r-- | sound/usb/endpoint.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c index 105ece3c14e3..c686ec8e8fa1 100644 --- a/sound/usb/endpoint.c +++ b/sound/usb/endpoint.c @@ -409,6 +409,9 @@ exit_clear: * * New endpoints will be added to chip->ep_list and must be freed by * calling snd_usb_endpoint_free(). + * + * For SND_USB_ENDPOINT_TYPE_SYNC, the caller needs to guarantee that + * bNumEndpoints > 1 beforehand. */ struct snd_usb_endpoint *snd_usb_add_endpoint(struct snd_usb_audio *chip, struct usb_host_interface *alts, |