Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Qican Ma" <goonsomeway@gmail.com>
Cc: linux-rdma@vger.kernel.org, linux-s390@vger.kernel.org,
	"Heiko Carstens" <hca@linux.ibm.com>,
	"Vasily Gorbik" <gor@linux.ibm.com>,
	"Alexander Gordeev" <agordeev@linux.ibm.com>,
	"Christian Borntraeger" <borntraeger@linux.ibm.com>
Subject: Re: [PATCH net v4] net/smc: serialize clcsock release against CDC receive path
Date: Sat, 05 Dec 2026 02:20:48 +0000	[thread overview]
Message-ID: <sashiko-outbox-250940@kernel.org> (raw)
In-Reply-To: <179635082914.26472.6075133370101625319@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] net/smc: redundant and ineffective conn->freed guard in
  smc_tx_is_corked()
--

commit 496edff7fbb2f3dcea39d11cf640ad5d5b6ccbac
Author: Qican Ma <goonsomeway@gmail.com>

net/smc: serialize clcsock release against CDC receive path

This commit frees the SMC connection before releasing clcsock in
__smc_release(), guards smc_cdc_msg_recv() and smc_tx_is_corked() on
conn->freed, and annotates conn->freed accesses with READ_ONCE() and
WRITE_ONCE().

[ ... ]

> diff --git a/net/smc/smc_tx.c b/net/smc/smc_tx.c
> index 386d172c57528..04baccad21f5d 100644
> --- a/net/smc/smc_tx.c
> +++ b/net/smc/smc_tx.c
> @@ -126,8 +126,12 @@ static int smc_tx_wait(struct smc_sock *smc, int flags)
>  
>  static bool smc_tx_is_corked(struct smc_sock *smc)
>  {
> -	struct tcp_sock *tp = tcp_sk(smc->clcsock->sk);
> +	struct tcp_sock *tp;
>  
> +	if (smc->conn.freed || !smc->clcsock)
> +		return true;
> +
> +	tp = tcp_sk(smc->clcsock->sk);
>  	return (tp->nonagle & TCP_NAGLE_CORK) ? true : false;
>  }

[Severity: Low]
Can smc_tx_is_corked() ever observe conn->freed or a NULL smc->clcsock?

Its only call chain is smc_sendmsg() -> smc_tx_sendmsg() ->
smc_tx_should_cork() -> smc_tx_is_corked() under lock_sock(sk).
smc_sendmsg() rejects SMC_CLOSED and smc_tx_wait() rechecks teardown after
reacquiring lock_sock(sk), while teardown sets SMC_CLOSED under lock_sock().

Even if it were reachable, returning true here does not prevent RDMA writes
as the commit message states.  smc_tx_should_cork() gates smc_tx_is_corked()
on atomic_read(&conn->sndbuf_space), so when a send fills the buffer,
smc_tx_sndbuf_nonempty() still runs after conn->sndbuf_desc was already used.

The commit message also states that both writer and reader of smc->clcsock
run under lock_sock(), but smc_clcsock_release() clears and frees
smc->clcsock under clcsock_release_lock after release_sock(sk).

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/179635082914.26472.6075133370101625319@gmail.com?part=1

  parent reply	other threads:[~2026-12-05  2:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04  2:20 [PATCH net v4] net/smc: serialize clcsock release against CDC receive path Qican Ma
2026-12-04  6:36 ` Mahanta Jambigi
2026-12-05  2:20 ` sashiko-bot [this message]
2026-12-05  3:05 ` 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-250940@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=goonsomeway@gmail.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@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