aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2010-06-21 11:03:21 -0400
committerTakashi Iwai <tiwai@suse.de>2010-06-21 11:07:58 -0400
commit272cbc98cfbdd30cff37a35f8ad8f1b737288e88 (patch)
tree9ac944574d3a98e106a11d362cb69293cacb0d48 /sound
parent2a383cb3f1a571b281c2e1ace4c8491f0370e866 (diff)
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 <jslaby@suse.cz> Acked-by: Daniel Mack <daniel@caiaq.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/usb/endpoint.c1
1 files changed, 1 insertions, 0 deletions
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)
427 if (snd_usb_parse_audio_format(chip, fp, format, fmt, stream, alts) < 0) { 427 if (snd_usb_parse_audio_format(chip, fp, format, fmt, stream, alts) < 0) {
428 kfree(fp->rate_table); 428 kfree(fp->rate_table);
429 kfree(fp); 429 kfree(fp);
430 fp = NULL;
430 continue; 431 continue;
431 } 432 }
432 433