Article View: linux.kernel.netdev
Article #3569[PATCH net v5 1/2] net/smc: order the CDC receive path against RMB publication
From: Bryam Vargas via B4 Relay
Date: Thu, 15 Oct 2026 11:53
Date: Thu, 15 Oct 2026 11:53
64 lines
9031 bytes
9031 bytes
From: Bryam Vargas <hexlabsecurity@proton.me>
smc_conn_create() adds an SMC-R connection to the token tree before
smc_buf_create() sets conn->rmb_desc. Tokens come from one global
counter, so a peer in the link group can predict the next one. A CDC
with that token, arriving in the window, makes
smc_cdc_msg_recv_action() dereference a NULL rmb_desc in softirq.
Set rmb_desc with a release store after the receive fields that go
with it, and drop a CDC in smc_cdc_rx_handler() while rmb_desc is
unset. A conforming peer learns the token only from the CLC accept or
confirm, sent after smc_buf_create(), so nothing it sends is dropped.
The SMC-D receive tasklet needs no check: smc_ism_set_conn() publishes
the connection under smcd->lock, which smcd_handle_irq() also takes.
Fixes: 69cb7dc0218b ("net/smc: add common buffer size in send and receive buffer descriptors")
Closes: https://sashiko.dev/#/patchset/20261008-b4-disp-f7cd3d96-v6-0-fba616c0920c@proton.me?part=1
Cc: stable@vger.kernel.org
Signed-off-by: Bryam Vargas <hexlabsecurity@proton.me>
---
net/smc/smc_cdc.c | 6 +++++-
net/smc/smc_core.c | 3 ++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/net/smc/smc_cdc.c b/net/smc/smc_cdc.c
index 32d6d03df321..7bf902ebd7ab 100644
--- a/net/smc/smc_cdc.c
+++ b/net/smc/smc_cdc.c
@@ -483,7 +483,11 @@ static void smc_cdc_rx_handler(struct ib_wc *wc, void *buf)
lgr = smc_get_lgr(link);
read_lock_bh(&lgr->conns_lock);
conn = smc_lgr_find_conn(ntohl(cdc->token), lgr);
- if (!conn || conn->out_of_sync) {
+ /* The connection is in the token tree before __smc_buf_create()
+ * sets its RMB: drop a CDC that comes earlier. rmb_desc is never
+ * cleared, so the callees can load it plainly.
+ */
+ if (!conn || conn->out_of_sync || !smp_load_acquire(&conn->rmb_desc)) {
read_unlock_bh(&lgr->conns_lock);
return;
}
diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c
index 9974149659c2..26f19a00c159 100644
--- a/net/smc/smc_core.c
+++ b/net/smc/smc_core.c
@@ -2502,12 +2502,13 @@ static int __smc_buf_create(struct smc_sock *smc, bool is_smcd, bool is_rmb)
}
if (is_rmb) {
- conn->rmb_desc = buf_desc;
conn->rmbe_size_comp = bufsize_comp;
smc->sk.sk_rcvbuf = bufsize * 2;
atomic_set(&conn->bytes_to_rcv, 0);
conn->rmbe_update_limit =
smc_rmb_wnd_update_limit(buf_desc->len);
+ /* Set last; pairs with the acquire in smc_cdc_rx_handler() */
+ smp_store_release(&conn->rmb_desc, buf_desc);
if (is_smcd)
smc_ism_set_conn(conn); /* map RMB/smcd_dev to conn */
} else {
--
2.56.0
Technical Details
Message-ID:
<20261015-b4-disp-2a8d85ef-v5-1-6b795e8263c9@proton.me>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-346717-linux-kernel-netdev=dewy.ruReferences:
<20261015-b4-disp-2a8d85ef-v5-0-6b795e8263c9@proton.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-346717-linux-kernel-netdev=dewy.ru From: devnull+hexlabsecurity.proton.me@kernel.org (Bryam Vargas via B4 Relay) Newsgroups: linux.kernel.netdev Subject: [PATCH net v5 1/2] net/smc: order the CDC receive path against RMB publication Date: Thu, 15 Oct 2026 06:53:31 -0500 Organization: Usenet Network Message-ID: <20261015-b4-disp-2a8d85ef-v5-1-6b795e8263c9@proton.me> References: <20261015-b4-disp-2a8d85ef-v5-0-6b795e8263c9@proton.me> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="2521290"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:aO1NbZROdS9/woncbJG7ku0OE4Q= sha256:foGQFgYGXH76opLDDsVrPZYLIyuDBJ0+oIrRailuA24= sha1:cqxMuHJr38F1Hl3QvyE+i/RqmSA= sha256:L1cy9afPCDObsvmb6cH94Z4IPRPf86xM8+Wi2XtfRB8= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id F34041102EF; Thu, 15 Oct 2026 14:53:53 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.639 X-Spam-Status: No, score=-3.639 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.24, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Gab1Um4pMZtX; Thu, 15 Oct 2026 14:53:49 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-346717-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 9AC4B11025A; Thu, 15 Oct 2026 14:53:41 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by tor.lore.kernel.org (Postfix) with ESMTP id 1C88A2A64C; Thu, 15 Oct 2026 11:53:37 +0000 (UTC) X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DC371519DF1; Thu, 15 Oct 2026 11:53:32 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jDh2xctB" X-Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B2BFF4A3F02; Thu, 15 Oct 2026 11:53:32 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792065212; cv=none; b=Z3wLl6kNElYC4+buDLPbZlmRsd3eGi1mbjaMkLubkPLbkgy51j51RqG1SFVR+TbHnousbDy6x0ie0fmkLg9TALwKe7VgYuPOh0dxSiNvy1Xb2fQzQE+vTkvlAgyCDvv1DKIQkkr507iWnFtYT9DzTuZbFaEomZ1GAbnEx/NDN/c= X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792065212; c=relaxed/simple; bh=ogAfELoWRdI0PfAU9oY1PA87qQANTy9itKTyiOcA0Sw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rFzKvjb8UPfftYHlq+TPnCrF5uN74LVPM2BLIAVAIG6yrEwMCGf4aJmCsjvk0wWJVESMczPher6dJs22m5vtVf7l96rvxD7ftYsqvThmKcMytk+pctPmK9VvACN2ojRHg1rFTlY6LIKsINY+mxg7sQgyLJm1U2e3XUAQ5RTyRcc= X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jDh2xctB; arc=none smtp.client-ip=10.30.226.201 X-Received: by smtp.kernel.org (Postfix) with ESMTPS id 6325AC2BCFB; Thu, 15 Oct 2026 11:53:32 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1792065212; bh=ogAfELoWRdI0PfAU9oY1PA87qQANTy9itKTyiOcA0Sw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=jDh2xctBCNOyIdNsPTNZlgCbSOlBhmJp0equWIFAJrIvUChZq7P5NW1jg+T8GJ30t pUYfeOrR8GNxW+nZjKbvSJCMt6A14CjLUwJF1s/rjRYMkVzVG506A1wqDzQQ1UYy0b lWmuXzFFPWpE4MZoSM2cLLtH9wUqw7Dqcy8/5jE3HGEJUN8HfjY9+ysy+l4+y8AvCF LIfDPbpCdwTz1lrNpJKeQH0kAKaw7HEHi1DvUJm52lMFhZW0lv/GXur78pesgOqaXp yH8LdLVAxh0SPIG/gh5P6NPI+4vPxIpUkVUYK60ON/XbuUikWRfDgASUaV4avHVKlC wHuBHJTQYcLLw== X-Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4211ECC6B3C; Thu, 15 Oct 2026 11:53:32 +0000 (UTC) X-Precedence: bulk X-Mailing-List: netdev@vger.kernel.org X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-In-Reply-To: <20261015-b4-disp-2a8d85ef-v5-0-6b795e8263c9@proton.me> X-Cc: Simon Horman <horms@kernel.org>, Wenjia Zhang <wenjia@linux.ibm.com>, Ursula Braun <ubraun@linux.ibm.com>, Hans Wippel <hwippel@linux.ibm.com>, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Tony Lu <tonylu@linux.alibaba.com>, linux-rdma@vger.kernel.org, Wen Gu <guwen@linux.alibaba.com>, linux-s390@vger.kernel.org X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1792065211; l=2567; i=hexlabsecurity@proton.me; s=default; h=from:subject:message-id; bh=kHI7XJJXDLRn/IVI2eJi27K/PrutBbPvH2QzLorLnNQ=; b=lhNYkaeY++smtZE7MyF5+Dw8w8T9hdojbqE04iKZvw0WFI93sfcMsaHK0U+mMXCmQ2Jd3K1gf dvgUdqKGiHRC7qkbCtADeerab3D+D+WjXoPMxHPjkeLg8/H8skphmQQ X-Developer-Key: i=hexlabsecurity@proton.me; a=ed25519; pk=xw1AhCtQdvuoQc+bOQIYy9o8G++cp4/VniI2G/tc3G8= X-Endpoint-Received: by B4 Relay for hexlabsecurity@proton.me/default with auth_id=893 X-Original-From: Bryam Vargas <hexlabsecurity@proton.me> X-Reply-To: hexlabsecurity@proton.me