ALSA: usb-audio: Fix possible NULL dereference at create_yamaha_midi_quirk()
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: 57f8770620
("ALSA: usb-audio: More validations of descriptor units")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
e0ccdef926
commit
60849562a5
|
@ -248,8 +248,8 @@ static int create_yamaha_midi_quirk(struct snd_usb_audio *chip,
|
||||||
NULL, USB_MS_MIDI_OUT_JACK);
|
NULL, USB_MS_MIDI_OUT_JACK);
|
||||||
if (!injd && !outjd)
|
if (!injd && !outjd)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
if (!snd_usb_validate_midi_desc(injd) ||
|
if (!(injd && snd_usb_validate_midi_desc(injd)) ||
|
||||||
!snd_usb_validate_midi_desc(outjd))
|
!(outjd && snd_usb_validate_midi_desc(outjd)))
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
if (injd && (injd->bLength < 5 ||
|
if (injd && (injd->bLength < 5 ||
|
||||||
(injd->bJackType != USB_MS_EMBEDDED &&
|
(injd->bJackType != USB_MS_EMBEDDED &&
|
||||||
|
|
Loading…
Reference in New Issue