Skip to contentSkip to conversation

midi: avoid freeing umidi object twice

PATCH Applied Andrey Konovalov 2 participants 2 messages Feb 13, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 midi: avoid freeing umidi object twice

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.

---
 sound/usb/midi.c | 1 -
 1 file changed, 1 deletion(-)
sound/usb/midi.c +0 -1
index cc39f63..007cf58 100644
@@ -2455,7 +2455,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;
 	}
 
Signature · 1 line
1.9.1
Applied
#1 lore raw
Quoted 9 lines · Andrey Konovalov

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.

Thanks, applied now with Cc to stable.

Takashi

Quoted 20 lines
---
 sound/usb/midi.c | 1 -
 1 file changed, 1 deletion(-)
sound/usb/midi.c +0 -1
index cc39f63..007cf58 100644
@@ -2455,7 +2455,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;
 	}
 
Signature · 1 line
1.9.1