diff options
Diffstat (limited to 'sound/usb/stream.c')
-rw-r--r-- | sound/usb/stream.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sound/usb/stream.c b/sound/usb/stream.c index 51258a15f653..6fe7f210bd4e 100644 --- a/sound/usb/stream.c +++ b/sound/usb/stream.c | |||
@@ -316,7 +316,9 @@ static struct snd_pcm_chmap_elem *convert_chmap(int channels, unsigned int bits, | |||
316 | /* | 316 | /* |
317 | * add this endpoint to the chip instance. | 317 | * add this endpoint to the chip instance. |
318 | * if a stream with the same endpoint already exists, append to it. | 318 | * if a stream with the same endpoint already exists, append to it. |
319 | * if not, create a new pcm stream. | 319 | * if not, create a new pcm stream. note, fp is added to the substream |
320 | * fmt_list and will be freed on the chip instance release. do not free | ||
321 | * fp or do remove it from the substream fmt_list to avoid double-free. | ||
320 | */ | 322 | */ |
321 | int snd_usb_add_audio_stream(struct snd_usb_audio *chip, | 323 | int snd_usb_add_audio_stream(struct snd_usb_audio *chip, |
322 | int stream, | 324 | int stream, |
@@ -677,6 +679,7 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no) | |||
677 | * (fp->maxpacksize & 0x7ff); | 679 | * (fp->maxpacksize & 0x7ff); |
678 | fp->attributes = parse_uac_endpoint_attributes(chip, alts, protocol, iface_no); | 680 | fp->attributes = parse_uac_endpoint_attributes(chip, alts, protocol, iface_no); |
679 | fp->clock = clock; | 681 | fp->clock = clock; |
682 | INIT_LIST_HEAD(&fp->list); | ||
680 | 683 | ||
681 | /* some quirks for attributes here */ | 684 | /* some quirks for attributes here */ |
682 | 685 | ||
@@ -725,6 +728,7 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no) | |||
725 | dev_dbg(&dev->dev, "%u:%d: add audio endpoint %#x\n", iface_no, altno, fp->endpoint); | 728 | dev_dbg(&dev->dev, "%u:%d: add audio endpoint %#x\n", iface_no, altno, fp->endpoint); |
726 | err = snd_usb_add_audio_stream(chip, stream, fp); | 729 | err = snd_usb_add_audio_stream(chip, stream, fp); |
727 | if (err < 0) { | 730 | if (err < 0) { |
731 | list_del(&fp->list); /* unlink for avoiding double-free */ | ||
728 | kfree(fp->rate_table); | 732 | kfree(fp->rate_table); |
729 | kfree(fp->chmap); | 733 | kfree(fp->chmap); |
730 | kfree(fp); | 734 | kfree(fp); |