[PATCH v2 net-next 4/7] smb: client: Add missing net_passive_dec().

Kuniyuki Iwashima
2025-05-23T18:23:33Z

While reverting commit e9f2517a3e18 ("smb: client: fix TCP timers deadlock
after rmmod"), I should have added net_passive_dec(), which was added
between the original commit and the revert by commit 5c70eb5c593d ("net:
better track kernel sockets lifetime").

Let's call net_passive_dec() in generic_ip_connect().

Note that this commit is only needed for 6.14+.

Fixes: 95d2b9f693ff ("Revert "smb: client: fix TCP timers deadlock after rmmod"")
Cc: <stable@vger.kernel.org> # 6.14.x
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
---
fs/smb/client/connect.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c
index 37a2ba38f10e..afac23a5a3ec 100644
--- a/fs/smb/client/connect.c
+++ b/fs/smb/client/connect.c
@@ -3359,6 +3359,7 @@ generic_ip_connect(struct TCP_Server_Info *server)

sk = server->ssocket->sk;
__netns_tracker_free(net, &sk->ns_tracker, false);
+ net_passive_dec(net);
sk->sk_net_refcnt = 1;
get_net_track(net, &sk->ns_tracker, GFP_KERNEL);
sock_inuse_add(net, 1);
--
2.49.0