From: Jiri Slaby Date: Mon, 21 Jun 2010 15:03:21 +0000 (+0200) Subject: ALSA: usb/endpoint, fix dangling pointer use X-Git-Tag: firefly_0821_release~9833^2~1428^2^2~1 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=272cbc98cfbdd30cff37a35f8ad8f1b737288e88;p=firefly-linux-kernel-4.4.55.git 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: Jiri Slaby Acked-by: Daniel Mack Signed-off-by: Takashi Iwai --- diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c index 9593b91452b9..6f6596cf2b19 100644 --- a/sound/usb/endpoint.c +++ b/sound/usb/endpoint.c @@ -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) { kfree(fp->rate_table); kfree(fp); + fp = NULL; continue; }