From: sashiko-bot@kernel.org
To: "Hidayath Khan" <hidayath@linux.ibm.com>
Cc: "Vasily Gorbik" <gor@linux.ibm.com>,
"Alexander Gordeev" <agordeev@linux.ibm.com>,
linux-rdma@vger.kernel.org, linux-s390@vger.kernel.org,
"Heiko Carstens" <hca@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@linux.ibm.com>
Subject: Re: [PATCH net v3] net/smc: fix abort_work termination in smc_conn_free()
Date: Wed, 07 Oct 2026 07:36:05 +0000 [thread overview]
Message-ID: <sashiko-outbox-162715@kernel.org> (raw)
In-Reply-To: <20261006073550.1595003-1-hidayath@linux.ibm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] net/smc: zombie abort_work terminates valid fallback connection
--
commit cebb96f694baa10cd5a7d057d497a08031c69485
Author: Hidayath Khan <hidayath@linux.ibm.com>
net/smc: fix abort_work termination in smc_conn_free()
This commit switches smc_conn_free() to use a non-blocking cancel_work()
for abort_work to avoid deadlocks. It also adds a check for conn->freed
inside smc_conn_abort_work() and initializes abort_work once per socket
in smc_sk_init() instead of per connection.
Link: https://lore.kernel.org/netdev/20260806081549.595001-1-hidayath@linux.ibm.com/
> diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c
> index 9974149659c2f..907530e1d6464 100644
> --- a/net/smc/smc_core.c
> +++ b/net/smc/smc_core.c
[ ... ]
> @@ -1276,8 +1280,13 @@ 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);
> + /* Do not wait here: the work takes the socket lock this
> + * caller holds. An instance that is already running is
> + * parked on that lock and will find conn->freed set; only a
> + * still-pending one has to give its reference back.
> + */
> + if (cancel_work(&conn->abort_work))
> + sock_put(&smc->sk);
[Severity: High]
Does changing this to a non-blocking cancel_work() introduce a race with
server-side fallback connections?
During server listen, smc_listen_find_device() iterates over proposed
devices while holding the socket lock. If an initial connection attempt
calls smc_conn_create() but fails and is aborted via smc_conn_free(), an
abort_work queued concurrently could transition to running but block on the
socket lock.
Since cancel_work() does not wait, it would return false for the running
worker and leave it parked on the lock. When the fallback loop continues,
it calls smc_conn_create() for the next device on the same socket, which
unconditionally resets the flag:
net/smc/smc_core.c:smc_conn_create() {
...
conn->freed = 0;
...
}
When the fallback connection ultimately succeeds and releases the socket
lock, could the parked abort_work unblock, observe the reset conn->freed
flag, and erroneously call smc_conn_kill() on the new, valid connection?
> }
> if (!list_empty(&lgr->list)) {
> smc_buf_unuse(conn, lgr); /* allow buffer reuse */
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261006073550.1595003-1-hidayath@linux.ibm.com?part=1
next prev parent reply other threads:[~2026-10-07 7:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-06 7:35 [PATCH net v3] net/smc: fix abort_work termination in smc_conn_free() Hidayath Khan
2026-10-06 7:39 ` netdev-bot+sinfo
2026-10-07 7:36 ` sashiko-bot [this message]
2026-10-08 19:38 ` netdev-bot+sashiko
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=sashiko-outbox-162715@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=hidayath@linux.ibm.com \
--cc=linux-rdma@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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