Thread View: linux.kernel.netdev
7 messages
7 total messages
Started by Mahanta Jambigi
Tue, 24 Nov 2026 07:36
[PATCH net] net/smc: fix sock reference leak on abort_work cancel
Author: Mahanta Jambigi
Date: Tue, 24 Nov 2026 07:36
Date: Tue, 24 Nov 2026 07:36
44 lines
13730 bytes
13730 bytes
smc_cdc_msg_validate() takes a reference on the socket before queueing
conn->abort_work, and smc_conn_abort_work() drops it when it runs. When
smc_conn_free() cancels the work while it is still pending, for example
because a close races with a failed CDC validation, the handler never
runs and the reference is leaked, so the SMC socket is never freed.
Drop the reference when cancel_work_sync() reports that it cancelled a
pending work.
Fixes: b286a0651e44 ("net/smc: handle incoming CDC validation message")
Cc: stable@vger.kernel.org
Signed-off-by: Mahanta Jambigi <mjambigi@linux.ibm.com>
---
net/smc/smc_core.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c
index a3164201c142..3c08be976de2 100644
--- a/net/smc/smc_core.c
+++ b/net/smc/smc_core.c
@@ -1276,6 +1276,7 @@ static void smc_buf_unuse(struct smc_connection *conn,
/* remove a finished connection from its link group */
void smc_conn_free(struct smc_connection *conn)
{
+ struct smc_sock *smc = container_of(conn, struct smc_sock, conn);
struct smc_link_group *lgr = conn->lgr;
if (!lgr || conn->freed)
@@ -1298,8 +1299,9 @@ void smc_conn_free(struct smc_connection *conn)
smcd_buf_detach(conn);
} else {
smc_cdc_wait_pend_tx_wr(conn);
- if (current_work() != &conn->abort_work)
- cancel_work_sync(&conn->abort_work);
+ if (current_work() != &conn->abort_work &&
+ cancel_work_sync(&conn->abort_work))
+ sock_put(&smc->sk);
}
/* The handshake can retry another device or SMC version with this
* connection, so it must never stay registered in an lgr it left.
--
2.50.1 (Apple Git-155)
Re: [PATCH net] net/smc: fix sock reference leak on abort_work cancel
Author: netdev-bot+sinfo
Date: Tue, 24 Nov 2026 07:43
Date: Tue, 24 Nov 2026 07:43
23 lines
8780 bytes
8780 bytes
Hi! This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information: - How the issue was discovered, e.g. hit in production, hit during development, syzbot report, manual code inspection, LLM or static analysis tool scan. - Whether the issue was actually triggered, or is only theoretical (e.g. found by LLM and not proven at runtime). If it was triggered please include the symptoms, like the stack trace or kernel messages. Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account. *IMPORTANT*: If you do repost (for other reasons) - please include the relevant info in the cover letter or commit messages. -- The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.
Re: [PATCH net] net/smc: fix sock reference leak on abort_work cancel
Author: Sidraya Jayagond
Date: Wed, 25 Nov 2026 07:07
Date: Wed, 25 Nov 2026 07:07
52 lines
14002 bytes
14002 bytes
On 24/11/26 1:06 pm, Mahanta Jambigi wrote:
> smc_cdc_msg_validate() takes a reference on the socket before queueing
> conn->abort_work, and smc_conn_abort_work() drops it when it runs. When
> smc_conn_free() cancels the work while it is still pending, for example
> because a close races with a failed CDC validation, the handler never
> runs and the reference is leaked, so the SMC socket is never freed.
>
> Drop the reference when cancel_work_sync() reports that it cancelled a
> pending work.
>
> Fixes: b286a0651e44 ("net/smc: handle incoming CDC validation message")
> Cc: stable@vger.kernel.org
> Signed-off-by: Mahanta Jambigi <mjambigi@linux.ibm.com>
> ---
> net/smc/smc_core.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c
> index a3164201c142..3c08be976de2 100644
> --- a/net/smc/smc_core.c
> +++ b/net/smc/smc_core.c
> @@ -1276,6 +1276,7 @@ static void smc_buf_unuse(struct smc_connection *conn,
> /* remove a finished connection from its link group */
> void smc_conn_free(struct smc_connection *conn)
> {
> + struct smc_sock *smc = container_of(conn, struct smc_sock, conn);
> struct smc_link_group *lgr = conn->lgr;
>
> if (!lgr || conn->freed)
> @@ -1298,8 +1299,9 @@ void smc_conn_free(struct smc_connection *conn)
> smcd_buf_detach(conn);
> } else {
> smc_cdc_wait_pend_tx_wr(conn);
> - if (current_work() != &conn->abort_work)
> - cancel_work_sync(&conn->abort_work);
> + if (current_work() != &conn->abort_work &&
> + cancel_work_sync(&conn->abort_work))
> + sock_put(&smc->sk);
> }
> /* The handshake can retry another device or SMC version with this
> * connection, so it must never stay registered in an lgr it left.
> --
> 2.50.1 (Apple Git-155)
>
>
Worth looking into the bot's discovery/validation point.
Patch looks good to me.
Reviewed-by: Sidraya Jayagond <sidraya@linux.ibm.com>
Re: [PATCH net] net/smc: fix sock reference leak on abort_work cancel
Author: Dust Li
Date: Wed, 25 Nov 2026 07:28
Date: Wed, 25 Nov 2026 07:28
19 lines
9196 bytes
9196 bytes
On 2026-11-24 08:36:02, Mahanta Jambigi wrote:
>smc_cdc_msg_validate() takes a reference on the socket before queueing
>conn->abort_work, and smc_conn_abort_work() drops it when it runs. When
>smc_conn_free() cancels the work while it is still pending, for example
>because a close races with a failed CDC validation, the handler never
>runs and the reference is leaked, so the SMC socket is never freed.
>
>Drop the reference when cancel_work_sync() reports that it cancelled a
>pending work.
>
>Fixes: b286a0651e44 ("net/smc: handle incoming CDC validation message")
>Cc: stable@vger.kernel.org
>Signed-off-by: Mahanta Jambigi <mjambigi@linux.ibm.com>
Reviewed-by: Dust Li <dust.li@linux.alibaba.com>
Best regards,
Dust
Re: [PATCH net] net/smc: fix sock reference leak on abort_work cancel
Author: Mahanta Jambigi
Date: Tue, 01 Dec 2026 05:48
Date: Tue, 01 Dec 2026 05:48
31 lines
13718 bytes
13718 bytes
On 24/11/26 1:13 pm, netdev-bot+sinfo@kernel.org wrote: > Hi! > > This is an automated message. This series looks like a fix, but its > commit messages seem to be missing some information: > > - How the issue was discovered, e.g. hit in production, hit during > development, syzbot report, manual code inspection, LLM or static > analysis tool scan. Manual code inspection while reviewing the CDC validation and tear-down paths. No report, no reproducer, no tool. > > - Whether the issue was actually triggered, or is only theoretical > (e.g. found by LLM and not proven at runtime). If it was triggered > please include the symptoms, like the stack trace or kernel messages. Not triggered at runtime, and there is no stack trace to include: the failure is silent, the socket is simply never freed. smc_cdc_msg_validate() holds a reference only when queue_work() succeeds, and smc_conn_abort_work() is the only place that drops it. When smc_conn_free() cancels the work while it is still pending, cancel_work_sync() removes it, the handler never runs and the reference is lost. Once the work is running, cancel_work_sync() waits for it and returns false, so the leak needs the queued-but-not-started window, for example a close racing with a failed CDC validation.
Re: [PATCH net] net/smc: fix sock reference leak on abort_work cancel
Author: Mahanta Jambigi
Date: Tue, 01 Dec 2026 05:55
Date: Tue, 01 Dec 2026 05:55
20 lines
13322 bytes
13322 bytes
On 30/11/26 10:58 pm, Paolo Abeni wrote: > On 11/24/26 08:43, netdev-bot+sinfo@kernel.org wrote: >> This is an automated message. This series looks like a fix, but its >> commit messages seem to be missing some information: >> >> - How the issue was discovered, e.g. hit in production, hit during >> development, syzbot report, manual code inspection, LLM or static >> analysis tool scan. >> >> - Whether the issue was actually triggered, or is only theoretical >> (e.g. found by LLM and not proven at runtime). If it was triggered >> please include the symptoms, like the stack trace or kernel messages. > You need to answer here: this patch could be net-next material depending > on your answer. Lacking that we will opt for the most conservative > assumption (net-next). Sorry I missed these earlier; I've now responded to them.
Re: [PATCH net] net/smc: fix sock reference leak on abort_work cancel
Author: patchwork-bot+netdevbpf
Date: Tue, 01 Dec 2026 09:20
Date: Tue, 01 Dec 2026 09:20
26 lines
8934 bytes
8934 bytes
Hello:
This patch was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Tue, 24 Nov 2026 08:36:02 +0100 you wrote:
> smc_cdc_msg_validate() takes a reference on the socket before queueing
> conn->abort_work, and smc_conn_abort_work() drops it when it runs. When
> smc_conn_free() cancels the work while it is still pending, for example
> because a close races with a failed CDC validation, the handler never
> runs and the reference is leaked, so the SMC socket is never freed.
>
> Drop the reference when cancel_work_sync() reports that it cancelled a
> pending work.
>
> [...]
Here is the summary with links:
- [net] net/smc: fix sock reference leak on abort_work cancel
https://git.kernel.org/netdev/net-next/c/34d30f9e1f2d
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads