]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
ALSA: isight: fix leak of reference to firewire unit in error path of .probe callback
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Fri, 12 Oct 2018 05:25:22 +0000 (14:25 +0900)
committerMarcelo Henrique Cerri <marcelo.cerri@canonical.com>
Fri, 17 Jan 2020 17:20:45 +0000 (14:20 -0300)
BugLink: https://bugs.launchpad.net/bugs/1854975
[ Upstream commit 51e68fb0929c29e47e9074ca3e99ffd6021a1c5a ]

In some error paths, reference count of firewire unit is not decreased.
This commit fixes the bug.

Fixes: 5b14ec25a79b('ALSA: firewire: release reference count of firewire unit in .remove callback of bus driver')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
sound/firewire/isight.c

index 46092fa3ff9bf3632d41a67ce232766136b7f00f..1135bd5a5844f06eea8319be8e4906f9c6ce02d2 100644 (file)
@@ -639,7 +639,7 @@ static int isight_probe(struct fw_unit *unit,
        if (!isight->audio_base) {
                dev_err(&unit->device, "audio unit base not found\n");
                err = -ENXIO;
-               goto err_unit;
+               goto error;
        }
        fw_iso_resources_init(&isight->resources, unit);
 
@@ -668,12 +668,12 @@ static int isight_probe(struct fw_unit *unit,
        dev_set_drvdata(&unit->device, isight);
 
        return 0;
-
-err_unit:
-       fw_unit_put(isight->unit);
-       mutex_destroy(&isight->mutex);
 error:
        snd_card_free(card);
+
+       mutex_destroy(&isight->mutex);
+       fw_unit_put(isight->unit);
+
        return err;
 }