From: Takashi Iwai Date: Wed, 14 Jul 2021 17:00:21 +0000 (+0200) Subject: r8152: Fix potential PM refcount imbalance X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a5b9b064d3b0d737103539f1fabbba513ab49c66;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git r8152: Fix potential PM refcount imbalance [ 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 Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 64fdea332886..96f6edcb0062 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -3347,9 +3347,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);