[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220325150420.090118002@linuxfoundation.org>
Date: Fri, 25 Mar 2022 16:14:06 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Eric Dumazet <edumazet@...gle.com>,
赵子轩 <beraphin@...il.com>,
Stoyan Manolov <smanolov@...e.de>,
Jakub Kicinski <kuba@...nel.org>
Subject: [PATCH 5.15 05/37] llc: fix netdevice reference leaks in llc_ui_bind()
From: Eric Dumazet <edumazet@...gle.com>
commit 764f4eb6846f5475f1244767d24d25dd86528a4a upstream.
Whenever llc_ui_bind() and/or llc_ui_autobind()
took a reference on a netdevice but subsequently fail,
they must properly release their reference
or risk the infamous message from unregister_netdevice()
at device dismantle.
unregister_netdevice: waiting for eth0 to become free. Usage count = 3
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Eric Dumazet <edumazet@...gle.com>
Reported-by: 赵子轩 <beraphin@...il.com>
Reported-by: Stoyan Manolov <smanolov@...e.de>
Link: https://lore.kernel.org/r/20220323004147.1990845-1-eric.dumazet@gmail.com
Signed-off-by: Jakub Kicinski <kuba@...nel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
net/llc/af_llc.c | 8 ++++++++
1 file changed, 8 insertions(+)
--- a/net/llc/af_llc.c
+++ b/net/llc/af_llc.c
@@ -310,6 +310,10 @@ static int llc_ui_autobind(struct socket
sock_reset_flag(sk, SOCK_ZAPPED);
rc = 0;
out:
+ if (rc) {
+ dev_put(llc->dev);
+ llc->dev = NULL;
+ }
return rc;
}
@@ -407,6 +411,10 @@ static int llc_ui_bind(struct socket *so
out_put:
llc_sap_put(sap);
out:
+ if (rc) {
+ dev_put(llc->dev);
+ llc->dev = NULL;
+ }
release_sock(sk);
return rc;
}
Powered by blists - more mailing lists