All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Yifei Chu" <Chuyf26@linux.alibaba.com>
Cc: "Christian Borntraeger" <borntraeger@linux.ibm.com>,
	"Alexander Gordeev" <agordeev@linux.ibm.com>,
	linux-s390@vger.kernel.org, "Heiko Carstens" <hca@linux.ibm.com>,
	"Vasily Gorbik" <gor@linux.ibm.com>
Subject: Re: [PATCH v4] net/smc: release the internal TCP sock on IPPROTO_SMC socket creation failure
Date: Mon, 24 Aug 2026 02:39:04 +0000	[thread overview]
Message-ID: <20260824023905.477C01F000E9@smtp.kernel.org> (raw)
In-Reply-To: <178753843966.342810.566471390946765094@linux.alibaba.com>

> IPPROTO_SMC sockets create an internal TCP sock ("clcsock") from the
> proto->init hook. When socket creation fails after proto->init has
> run - e.g. a cgroup BPF program attached to BPF_CGROUP_INET_SOCK_CREATE
> denies the socket - sk_common_release() only invokes sk_prot->destroy
> if it is set, but neither smc_inet_prot nor smc_inet6_prot defines it,
> and smc_destruct() returns early unless sk_state is SMC_CLOSED. As a
> result, every failing socket(AF_INET, SOCK_STREAM, IPPROTO_SMC) call
> leaks one tcp_sock, so an unprivileged task able to attach a deny-all
> BPF_CGROUP_INET_SOCK_CREATE program to its own cgroup can grow kernel
> memory unboundedly.
> 
> Add a .destroy hook to both protos that releases the clcsock via
> smc_clcsock_release(). smc_sk_init() hashes the sock into the smc
> hashinfo before the clcsock is created, and smc_diag dumps walk that
> hash dereferencing smc->clcsock without taking clcsock_release_lock,
> while sk_common_release() calls .destroy before .unhash. Unhash the
> sock before releasing the clcsock, as __smc_release() does, so a
> concurrent dump cannot observe the release; the second unhash in
> sk_common_release() is a no-op.
> 
> Fixes: d25a92ccae6b ("net/smc: Introduce IPPROTO_SMC")
> Reported-by: Abaci <abaci@linux.alibaba.com>
> Assisted-by: abaci:qwen3.8-max
> Signed-off-by: Yifei Chu <Chuyf26@linux.alibaba.com>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/178753843966.342810.566471390946765094@linux.alibaba.com?part=1


  reply	other threads:[~2026-08-24  2:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-24  2:27 [PATCH v4] net/smc: release the internal TCP sock on IPPROTO_SMC socket creation failure Yifei Chu
2026-08-24  2:39 ` sashiko-bot [this message]
2026-08-26  7:42 ` Dust Li
2026-08-27  9:00 ` patchwork-bot+netdevbpf

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=20260824023905.477C01F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Chuyf26@linux.alibaba.com \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.