[PATCH 4.18 34/88] ALSA: firewire-digi00x: fix memory leak of private data

From: Greg Kroah-Hartman
Date: Thu Sep 27 2018 - 05:09:38 EST


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

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

From: Takashi Sakamoto <o-takashi@xxxxxxxxxxxxx>

commit a49a83ab05e34edd6c71a4fbd062c9a7ba6d18aa upstream.

Although private data of sound card instance is usually allocated in the
tail of the instance, drivers in ALSA firewire stack allocate the private
data before allocating the instance. In this case, the private data
should be released explicitly at .private_free callback of the instance.

This commit fixes memory leak following to the above design.

Fixes: 86c8dd7f4da3 ('ALSA: firewire-digi00x: delayed registration of sound card')
Cc: <stable@xxxxxxxxxxxxxxx> # v4.7+
Signed-off-by: Takashi Sakamoto <o-takashi@xxxxxxxxxxxxx>
Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
sound/firewire/digi00x/digi00x.c | 1 +
1 file changed, 1 insertion(+)

--- a/sound/firewire/digi00x/digi00x.c
+++ b/sound/firewire/digi00x/digi00x.c
@@ -49,6 +49,7 @@ static void dg00x_free(struct snd_dg00x
fw_unit_put(dg00x->unit);

mutex_destroy(&dg00x->mutex);
+ kfree(dg00x);
}

static void dg00x_card_free(struct snd_card *card)