Skip to content

Commit

Permalink
ALSA: usb/endpoint, fix dangling pointer use
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jiri Slaby authored and Takashi Iwai committed Jun 21, 2010
1 parent 2a383cb commit 272cbc9
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions sound/usb/endpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 272cbc9

Please sign in to comment.