]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ALSA: usb-audio: WARN_ON when alts is passed as NULL
authorEldad Zack <eldad@fogrefinery.com>
Sat, 3 Aug 2013 08:51:15 +0000 (10:51 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 6 Aug 2013 08:52:27 +0000 (10:52 +0200)
Prevent NULL dereference in snd_usb_add_endpoints(), when
alts is passed as NULL. In this case, WARN (since this is
a non-fatal bug) and return NULL ep. Call sites treat a NULL
return value as an error.

Signed-off-by: Eldad Zack <eldad@fogrefinery.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/endpoint.c

index 7a444b5501d91d28a4e7e8fb5e044c2b4e7ea41b..92ea945ff486cb12ec162dcfbb3f51ca1e8b4d7c 100644 (file)
@@ -418,6 +418,9 @@ struct snd_usb_endpoint *snd_usb_add_endpoint(struct snd_usb_audio *chip,
        struct snd_usb_endpoint *ep;
        int is_playback = direction == SNDRV_PCM_STREAM_PLAYBACK;
 
+       if (WARN_ON(!alts))
+               return NULL;
+
        mutex_lock(&chip->mutex);
 
        list_for_each_entry(ep, &chip->ep_list, list) {