[PATCH 2.6.32 51/55] ALSA: usb-audio: avoid freeing umidi object twice

From: Willy Tarreau
Date: Fri Mar 04 2016 - 11:13:52 EST


2.6.32-longterm review patch. If anyone has any objections, please let me know.

------------------

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>
Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx>
[wt: file is sound/midi/usbmidi.c in 2.6.32]
Signed-off-by: Willy Tarreau <w@xxxxxx>
---
sound/usb/usbmidi.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c
index 64d8d2e..366020a 100644
--- a/sound/usb/usbmidi.c
+++ b/sound/usb/usbmidi.c
@@ -1947,7 +1947,6 @@ int snd_usb_create_midi_interface(struct snd_usb_audio* chip,
else
err = snd_usbmidi_create_endpoints(umidi, endpoints);
if (err < 0) {
- snd_usbmidi_free(umidi);
return err;
}

--
1.7.12.2.21.g234cd45.dirty