Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e7e58df8 authored by Eldad Zack's avatar Eldad Zack Committed by Takashi Iwai
Browse files

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: default avatarEldad Zack <eldad@fogrefinery.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 88abb8ef
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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) {