]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
r8152: Fix potential PM refcount imbalance
authorTakashi Iwai <tiwai@suse.de>
Wed, 14 Jul 2021 17:00:21 +0000 (19:00 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 20 Sep 2021 13:42:36 +0000 (15:42 +0200)
BugLink: https://bugs.launchpad.net/bugs/1942123
[ Upstream commit 9c23aa51477a37f8b56c3c40192248db0663c196 ]

rtl8152_close() takes the refcount via usb_autopm_get_interface() but
it doesn't release when RTL8152_UNPLUG test hits.  This may lead to
the imbalance of PM refcount.  This patch addresses it.

Link: https://bugzilla.suse.com/show_bug.cgi?id=1186194
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
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>
drivers/net/usb/r8152.c

index 35d60d2b12fc51396fed5b91c1faaa351bf456f7..fba0b1430741b6906d3c4e14ffd710a1efb493da 100644 (file)
@@ -5265,9 +5265,10 @@ static int rtl8152_close(struct net_device *netdev)
                tp->rtl_ops.down(tp);
 
                mutex_unlock(&tp->control);
+       }
 
+       if (!res)
                usb_autopm_put_interface(tp->intf);
-       }
 
        free_all_mem(tp);