From: Wang Zhaolong <wangzhaolong1@huawei.com>
To: Kuniyuki Iwashima <kuniyu@amazon.com>, Steve French <sfrench@samba.org>
Cc: Paulo Alcantara <pc@manguebit.com>,
Ronnie Sahlberg <ronniesahlberg@gmail.com>,
Shyam Prasad N <sprasad@microsoft.com>,
Tom Talpey <tom@talpey.com>, Bharath SM <bharathsm@microsoft.com>,
Enzo Matsumiya <ematsumiya@suse.de>,
Kuniyuki Iwashima <kuni1840@gmail.com>,
<linux-cifs@vger.kernel.org>, <samba-technical@lists.samba.org>
Subject: Re: [PATCH 1/2] Revert "smb: client: Fix netns refcount imbalance causing leaks and use-after-free"
Date: Thu, 3 Apr 2025 11:16:11 +0800 [thread overview]
Message-ID: <28287f44-ad1c-4ed2-bb60-ed9209b719b1@huawei.com> (raw)
In-Reply-To: <20250402200319.2834-2-kuniyu@amazon.com>
Acked-by: Wang Zhaolong <wangzhaolong1@huawei.com>
> This reverts commit 4e7f1644f2ac6d01dc584f6301c3b1d5aac4eaef.
>
> The commit e9f2517a3e18 ("smb: client: fix TCP timers deadlock after
> rmmod") is not only a bogus fix for LOCKDEP null-ptr-deref but also
> introduces a real issue, TCP sockets leak, which will be explained in
> detail in the next revert.
>
> Also, CNA assigned CVE-2024-54680 to it but is rejecting it. [0]
>
> Thus, we are reverting the commit and its follow-up commit 4e7f1644f2ac
> ("smb: client: Fix netns refcount imbalance causing leaks and
> use-after-free").
>
> Link: https://lore.kernel.org/all/2025040248-tummy-smilingly-4240@gregkh/ #[0]
> Fixes: 4e7f1644f2ac ("smb: client: Fix netns refcount imbalance causing leaks and use-after-free")
> Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
> ---
> fs/smb/client/connect.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c
> index 10a7c28d2d44..137a611c5ab0 100644
> --- a/fs/smb/client/connect.c
> +++ b/fs/smb/client/connect.c
> @@ -300,7 +300,6 @@ cifs_abort_connection(struct TCP_Server_Info *server)
> server->ssocket->flags);
> sock_release(server->ssocket);
> server->ssocket = NULL;
> - put_net(cifs_net_ns(server));
> }
> server->sequence_number = 0;
> server->session_estab = false;
> @@ -3367,12 +3366,8 @@ generic_ip_connect(struct TCP_Server_Info *server)
> /*
> * Grab netns reference for the socket.
> *
> - * This reference will be released in several situations:
> - * - In the failure path before the cifsd thread is started.
> - * - In the all place where server->socket is released, it is
> - * also set to NULL.
> - * - Ultimately in clean_demultiplex_info(), during the final
> - * teardown.
> + * It'll be released here, on error, or in clean_demultiplex_info() upon server
> + * teardown.
> */
> get_net(net);
>
> @@ -3388,8 +3383,10 @@ generic_ip_connect(struct TCP_Server_Info *server)
> }
>
> rc = bind_socket(server);
> - if (rc < 0)
> + if (rc < 0) {
> + put_net(cifs_net_ns(server));
> return rc;
> + }
>
> /*
> * Eventually check for other socket options to change from
> @@ -3444,6 +3441,9 @@ generic_ip_connect(struct TCP_Server_Info *server)
> (server->rfc1001_sessinit == -1 && sport == htons(RFC1001_PORT)))
> rc = ip_rfc1001_connect(server);
>
> + if (rc < 0)
> + put_net(cifs_net_ns(server));
> +
> return rc;
> }
>
next prev parent reply other threads:[~2025-04-03 3:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-02 20:02 [PATCH 0/2] cifs: Revert bogus fix for CVE-2024-54680 and its followup commit Kuniyuki Iwashima
2025-04-02 20:02 ` [PATCH 1/2] Revert "smb: client: Fix netns refcount imbalance causing leaks and use-after-free" Kuniyuki Iwashima
2025-04-03 3:16 ` Wang Zhaolong [this message]
2025-04-03 9:59 ` Wang Zhaolong
2025-04-03 17:26 ` Kuniyuki Iwashima
2025-04-03 17:32 ` Steve French
2025-04-03 17:46 ` Kuniyuki Iwashima
2025-04-02 20:02 ` [PATCH 2/2] Revert "smb: client: fix TCP timers deadlock after rmmod" Kuniyuki Iwashima
2025-04-03 3:12 ` Wang Zhaolong
2025-04-03 1:14 ` [PATCH 0/2] cifs: Revert bogus fix for CVE-2024-54680 and its followup commit Steve French
2025-04-03 2:18 ` Kuniyuki Iwashima
2025-04-03 3:19 ` Steve French
2025-04-03 10:14 ` Wang Zhaolong
2025-04-11 7:04 ` Kuniyuki Iwashima
2025-04-12 17:28 ` Steve French
2025-04-12 19:10 ` Kuniyuki Iwashima
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=28287f44-ad1c-4ed2-bb60-ed9209b719b1@huawei.com \
--to=wangzhaolong1@huawei.com \
--cc=bharathsm@microsoft.com \
--cc=ematsumiya@suse.de \
--cc=kuni1840@gmail.com \
--cc=kuniyu@amazon.com \
--cc=linux-cifs@vger.kernel.org \
--cc=pc@manguebit.com \
--cc=ronniesahlberg@gmail.com \
--cc=samba-technical@lists.samba.org \
--cc=sfrench@samba.org \
--cc=sprasad@microsoft.com \
--cc=tom@talpey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox