diff options
author | Eldad Zack <eldad@fogrefinery.com> | 2013-08-03 04:51:15 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2013-08-06 04:52:27 -0400 |
commit | e7e58df8ef3c9edb09a240084b4e0523c12bcb71 (patch) | |
tree | 1708c1c42916ad6552c2ecc9e5cab623b7947aa1 /sound/usb/endpoint.c | |
parent | 88abb8eff494d0be7819e744e74d62d5bc852905 (diff) |
ALSA: usb-audio: WARN_ON when alts is passed as NULL
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>
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 7a444b5501d9..92ea945ff486 100644 --- a/sound/usb/endpoint.c +++ b/sound/usb/endpoint.c | |||
@@ -418,6 +418,9 @@ struct snd_usb_endpoint *snd_usb_add_endpoint(struct snd_usb_audio *chip, | |||
418 | struct snd_usb_endpoint *ep; | 418 | struct snd_usb_endpoint *ep; |
419 | int is_playback = direction == SNDRV_PCM_STREAM_PLAYBACK; | 419 | int is_playback = direction == SNDRV_PCM_STREAM_PLAYBACK; |
420 | 420 | ||
421 | if (WARN_ON(!alts)) | ||
422 | return NULL; | ||
423 | |||
421 | mutex_lock(&chip->mutex); | 424 | mutex_lock(&chip->mutex); |
422 | 425 | ||
423 | list_for_each_entry(ep, &chip->ep_list, list) { | 426 | list_for_each_entry(ep, &chip->ep_list, list) { |