diff options
author | Takashi Iwai <tiwai@suse.de> | 2019-08-20 18:17:09 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-11-12 21:20:48 +0300 |
commit | 17821e2fb16752f5d363fb5c3f8aab4df41b9bcc (patch) | |
tree | 9651161eda539472f4f109aff8d4fb17c8adac17 /sound/usb/quirks.c | |
parent | 5e36cf8edb5812e378b57511263d1a0a9172eeb9 (diff) | |
download | linux-17821e2fb16752f5d363fb5c3f8aab4df41b9bcc.tar.xz |
ALSA: usb-audio: More validations of descriptor units
commit 57f8770620e9b51c61089751f0b5ad3dbe376ff2 upstream.
Introduce a new helper to validate each audio descriptor unit before
and check the unit before actually accessing it. This should harden
against the OOB access cases with malformed descriptors that have been
recently frequently reported by fuzzers.
The existing descriptor checks are still kept although they become
superfluous after this patch. They'll be cleaned up eventually
later.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'sound/usb/quirks.c')
-rw-r--r-- | sound/usb/quirks.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index c102c0377ad9..282a18c2eff6 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -259,6 +259,9 @@ static int create_yamaha_midi_quirk(struct snd_usb_audio *chip, NULL, USB_MS_MIDI_OUT_JACK); if (!injd && !outjd) return -ENODEV; + if (!snd_usb_validate_midi_desc(injd) || + !snd_usb_validate_midi_desc(outjd)) + return -ENODEV; if (injd && (injd->bLength < 5 || (injd->bJackType != USB_MS_EMBEDDED && injd->bJackType != USB_MS_EXTERNAL))) |