Netdev List
 help / color / mirror / Atom feed
From: Mahanta Jambigi <mjambigi@linux.ibm.com>
To: Sidraya Jayagond <sidraya@linux.ibm.com>,
	andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, alibuda@linux.alibaba.com,
	dust.li@linux.alibaba.com
Cc: hidayath@linux.ibm.com, pasic@linux.ibm.com, horms@kernel.org,
	tonylu@linux.alibaba.com, guwen@linux.alibaba.com,
	netdev@vger.kernel.org, linux-s390@vger.kernel.org,
	linux-rdma@vger.kernel.org
Subject: Re: [PATCH net-next 0/3] net/smc: fix clcsock lifetime vs asynchronous paths
Date: Tue, 24 Nov 2026 13:26:05 +0530	[thread overview]
Message-ID: <8e5fe7d5-ee5e-42e6-b194-6e75abf402ad@linux.ibm.com> (raw)
In-Reply-To: <90fb64eb-8fd6-47de-8773-263701b2179c@linux.ibm.com>



On 23/11/26 12:08 pm, Sidraya Jayagond wrote:
> 
> 
> On 20/11/26 6:15 pm, Mahanta Jambigi wrote:
>> The internal TCP socket (clcsock) of an SMC socket is freed by
>> asynchronous paths: link group termination reaches
>> smc_close_active_abort() and peer close reaches
>> smc_close_passive_work(), and both can run while the SMC socket is still
>> referenced by an open file descriptor. A task that uses the fd at that
>> moment, for example getsockopt() or a socket diag dump, then operates on
>> a released socket.
>>
>> Free the clcsock only when no socket file can reference it: from the
>> socket release paths, after the socket has been unhashed, and from the
>> abnormal close paths once the socket has no file left. The decision is
>> made under the socket lock, and the accept path holds the same lock
>> across the accept-queue state check and sock_graft(), so a connection
>> that is being accepted cannot lose its clcsock to an asynchronous close.
>> The clcsock_release_lock is no longer needed: a socket operation on a
>> file is serialized with smc_release() by the file reference, and the
>> listen work is covered by flush_work() and cancel_work_sync() in
>> smc_clcsock_release().
>>
>> Trade-off: with an open file, a clcsock now stays allocated after an
>> abnormal close until the application closes the SMC fd. The SMC
>> connection is already torn down and its TCP connection has been reset or
>> shut down; only the local TCP socket remains allocated until then.
>>
>> Patch 1 makes the lifetime change and is self-contained. Patch 2 removes
>> the lock and the checks it made necessary, and serializes the accept
>> path with the asynchronous close. Patch 3 documents the invariant and
>> adds a destructor warning for it. The diag dump keeps its NULL check: a
>> socket is hashed in smc_sk_init(), before its clcsock is created.
>>
>> This is hardening found by code walk, not a fix for a reported
>> regression, so the series targets net-next and carries no Fixes: tag.
>>
>> Mahanta Jambigi (3):
>>   net/smc: keep clcsock until socket release
>>   net/smc: remove the clcsock release lock
>>   net/smc: document the clcsock lifetime
>>
>>  net/smc/af_smc.c    | 123 +++++++++++++++---------------------------
>>  net/smc/smc.h       |   8 ++-
>>  net/smc/smc_close.c |  35 +++++++++----
>>  net/smc/smc_diag.c  |   3 ++
>>  net/smc/smc_inet.c  |   9 ++--
>>  5 files changed, 82 insertions(+), 96 deletions(-)
>>
> 
> This series does not apply on net-next here.
> The cover letter carries no base-commit: b4 am reports "Base: not
> specified", so it is not possible to tell which tree the series was
> generated against. Please repost with the base recorded, so that b4 am
> and reviewers apply against the exact commit,for example:
>   git format-patch --base=origin/net-next -o outgoing/
> 
> which adds base-commit: <sha> to the cover letter. Naming the base SHA
> in the cover text is enough.
Thanks for the report. The series is based on net-next
eb6d6c80d354 ("net/sched: em_text: pad the text pattern in the ematch
dump"). I rebased it onto that commit and reposted it as v2; the cover
letter records the base:

  base-commit: eb6d6c80d35449c27471b1874f13066c09a8964d

Link:
https://lore.kernel.org/netdev/20261124074927.3622245-1-mjambigi@linux.ibm.com/

Could you please take another look?

  reply	other threads:[~2026-11-24  7:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 12:45 [PATCH net-next 0/3] net/smc: fix clcsock lifetime vs asynchronous paths Mahanta Jambigi
2026-11-20 12:45 ` [PATCH net-next 1/3] net/smc: keep clcsock until socket release Mahanta Jambigi
2026-11-20 12:45 ` [PATCH net-next 2/3] net/smc: remove the clcsock release lock Mahanta Jambigi
2026-11-20 12:45 ` [PATCH net-next 3/3] net/smc: document the clcsock lifetime Mahanta Jambigi
2026-11-23  6:38 ` [PATCH net-next 0/3] net/smc: fix clcsock lifetime vs asynchronous paths Sidraya Jayagond
2026-11-24  7:56   ` Mahanta Jambigi [this message]
2026-11-23  6:45 ` Sidraya Jayagond

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=8e5fe7d5-ee5e-42e6-b194-6e75abf402ad@linux.ibm.com \
    --to=mjambigi@linux.ibm.com \
    --cc=alibuda@linux.alibaba.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dust.li@linux.alibaba.com \
    --cc=edumazet@google.com \
    --cc=guwen@linux.alibaba.com \
    --cc=hidayath@linux.ibm.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pasic@linux.ibm.com \
    --cc=sidraya@linux.ibm.com \
    --cc=tonylu@linux.alibaba.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