[PATCH 3.16.y-ckt 010/129] ALSA: usb-audio: avoid freeing umidi object twice

From: Luis Henriques
Date: Fri Feb 26 2016 - 06:08:47 EST


3.16.7-ckt25 -stable review patch. If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Andrey Konovalov <andreyknvl@xxxxxxxxx>

commit 07d86ca93db7e5cdf4743564d98292042ec21af7 upstream.

The 'umidi' object will be free'd on the error path by snd_usbmidi_free()
when tearing down the rawmidi interface. So we shouldn't try to free it
in snd_usbmidi_create() after having registered the rawmidi interface.

Found by KASAN.

Signed-off-by: Andrey Konovalov <andreyknvl@xxxxxxxxx>
Acked-by: Clemens Ladisch <clemens@xxxxxxxxxx>
Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
Cc: Moritz Muehlenhoff <jmm@xxxxxxxxxx>
Signed-off-by: Luis Henriques <luis.henriques@xxxxxxxxxxxxx>
---
sound/usb/midi.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/sound/usb/midi.c b/sound/usb/midi.c
index 70c97cc4574c..a160a6b110f5 100644
--- a/sound/usb/midi.c
+++ b/sound/usb/midi.c
@@ -2368,7 +2368,6 @@ int snd_usbmidi_create(struct snd_card *card,
else
err = snd_usbmidi_create_endpoints(umidi, endpoints);
if (err < 0) {
- snd_usbmidi_free(umidi);
return err;
}