summaryrefslogtreecommitdiffstats
path: root/sound/usb
diff options
context:
space:
mode:
authorEldad Zack <eldad@fogrefinery.com>2013-08-03 10:51:15 +0200
committerTakashi Iwai <tiwai@suse.de>2013-08-06 10:52:27 +0200
commite7e58df8ef3c9edb09a240084b4e0523c12bcb71 (patch)
tree1708c1c42916ad6552c2ecc9e5cab623b7947aa1 /sound/usb
parent88abb8eff494d0be7819e744e74d62d5bc852905 (diff)
downloadop-kernel-dev-e7e58df8ef3c9edb09a240084b4e0523c12bcb71.zip
op-kernel-dev-e7e58df8ef3c9edb09a240084b4e0523c12bcb71.tar.gz
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')
-rw-r--r--sound/usb/endpoint.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index 7a444b5..92ea945 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,
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) {
OpenPOWER on IntegriCloud