diff options
author | Takashi Iwai <tiwai@suse.de> | 2019-08-26 14:55:21 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-11-12 21:20:49 +0300 |
commit | 4f6c5200269998f0066e1bd4db931297b7b2b906 (patch) | |
tree | bd526bc8c378809041d8bf02e07089c5ef02cdcd /sound | |
parent | 3a0cdf210b94f1cfbbab6687c82421784242702b (diff) | |
download | linux-4f6c5200269998f0066e1bd4db931297b7b2b906.tar.xz |
ALSA: usb-audio: Fix possible NULL dereference at create_yamaha_midi_quirk()
commit 60849562a5db4a1eee2160167e4dce4590d3eafe upstream.
The previous addition of descriptor validation may lead to a NULL
dereference at create_yamaha_midi_quirk() when either injd or outjd is
NULL. Add proper non-NULL checks.
Fixes: 57f8770620e9 ("ALSA: usb-audio: More validations of descriptor units")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/usb/quirks.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index 282a18c2eff6..ea253c97b8b9 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -259,8 +259,8 @@ 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)) + if (!(injd && snd_usb_validate_midi_desc(injd)) || + !(outjd && snd_usb_validate_midi_desc(outjd))) return -ENODEV; if (injd && (injd->bLength < 5 || (injd->bJackType != USB_MS_EMBEDDED && |