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

Commit 272cbc98 authored by Jiri Slaby's avatar Jiri Slaby Committed by Takashi Iwai
Browse files

ALSA: usb/endpoint, fix dangling pointer use



Stanse found that in snd_usb_parse_audio_endpoints, there is a
dangling pointer dereference. When snd_usb_parse_audio_format fails,
fp is freed, and continue invoked. On the next loop, there is
"fp && fp->altsetting == 1 && fp->channels == 1" test, but fp is set
from the last iteration (but is bogus) and thus ilegally dereferenced.

Set fp to NULL before "continue".

Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Acked-by: default avatarDaniel Mack <daniel@caiaq.de>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 2a383cb3
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -427,6 +427,7 @@ int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no)
		if (snd_usb_parse_audio_format(chip, fp, format, fmt, stream, alts) < 0) {
		if (snd_usb_parse_audio_format(chip, fp, format, fmt, stream, alts) < 0) {
			kfree(fp->rate_table);
			kfree(fp->rate_table);
			kfree(fp);
			kfree(fp);
			fp = NULL;
			continue;
			continue;
		}
		}