Article View: linux.kernel.netdev
Article #21578[PATCH net-next v2 0/3] net/smc: fix clcsock lifetime vs asynchronous paths
From: Mahanta Jambigi
Date: Tue, 24 Nov 2026 07:49
Date: Tue, 24 Nov 2026 07:49
61 lines
14830 bytes
14830 bytes
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. --- Changes in v2: - Rebased onto net-next (eb6d6c80d354) instead of the torvalds tree (7e1392a42ea2). The patch content is unchanged; the only differences are unrelated net-next context: patch 2 now shows the READ_ONCE() around limit_smc_hs, and hunk labels were re-derived. - Patch 1: clarify the commit message to say the issue was found by code inspection rather than from a reported regression, and to describe the conn->freed rationale more precisely. - No functional change to the series. 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(-) base-commit: eb6d6c80d35449c27471b1874f13066c09a8964d -- 2.50.1 (Apple Git-155)
Technical Details
Message-ID:
<20261124074927.3622245-1-mjambigi@linux.ibm.com>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-370079-linux-kernel-netdev=dewy.ruShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-370079-linux-kernel-netdev=dewy.ru
From: mjambigi@linux.ibm.com (Mahanta Jambigi)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v2 0/3] net/smc: fix clcsock lifetime vs asynchronous paths
Date: Tue, 24 Nov 2026 08:49:24 +0100
Organization: Usenet Network
Message-ID: <20261124074927.3622245-1-mjambigi@linux.ibm.com>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
logging-data="4082005"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:xobeXAPxmoaFioTO4Bm9AVJCq/0= sha256:AnaVRRs2W2emtPk34kNKSg5XNLvq72aDYyBBcUxx8mI=
sha1:hPXU9WIqOqnplzSzSs9AO+fHJMc= sha256:XPhtHDPonSboIygk/w+UNn4MUi2i6EliIq3I2p/ASB8=
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 99B8B125DDE; Tue, 24 Nov 2026 10:50:19 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.951
X-Spam-Status: No, score=-2.951 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=ibm.com
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 DzyVnffVI98x;
Tue, 24 Nov 2026 10:50:16 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-370079-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=linux.ibm.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id 15483125DD3; Tue, 24 Nov 2026 10:50:04 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sea.lore.kernel.org (Postfix) with ESMTP id 369B831F8D; Tue, 24 Nov 2026 07:50:02 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1795506602;
b=0TD63l8+cFXtCmh3u1HFO77VezDDDLBybWr7UxaEbJaou3ECbYdFjDSSNBVMj7OFiSYD
/R2h0LXTkuNTrRHi4YJoTYLxqvJV3B+QW23bIJ5fv8hgVfpd+pDNiMz94RUZmzOipLTMj
Rwp3YD1KO54nLuhX/cUP+ul/1/mOXTjY8PN/j3mwMdDZpJQE/pmrR5sBdr2R9oush/5nZ
2uxH+5LwVEqO84dpA2FJuA3mvCREqCoyNUk3M2uw3lUT+PZyZLBONMn4FPFsmTXI0a8gy
AyNiQoKJ58u85g7ej/ixYhskQU87IiWtAjtRpcULJtpJ4hPfJtZldH1FSSlmC/1rJeg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1795506602;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:Received:
Received:Received:Received:Received:Received:Received:Received:From:
To:Cc:Subject:Date:Message-ID:X-Mailer:X-Mailing-List:List-Id:
List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
Precedence:MIME-Version:Content-Transfer-Encoding:X-TM-AS-GCONF:
X-Proofpoint-Reinject:X-Proofpoint-ORIG-GUID:X-Proofpoint-Spam-Info:
X-Proofpoint-GUID:X-Authority-Analysis:X-Proofpoint-Spam-Details-Enc:
X-Proofpoint-Virus-Version:X-Proofpoint-Spam-Details;
bh=vFe9+xvHMJKBNQaIgGpMM8NokfA92ua0f4m4mQbWGmo=;
b=UiYgTviGQX4TfQIqxHqi5whHCvT7iFeksEd3zbuR1wkYyxGWyUzo5ywv+DkEWOaVKuKu
HZaQyVgXV4RkElvcEEtQwqdA+iZKHXD9ZxXay2lDDBTUIUqoCE65NO6/PmFLO0O/bR8RX
z1YlN7uo9ucecvcJTDiCeUgJPlZA9Zl/55dxNBedDouSptiJdl7yl176quxmARzlzDtiR
4gLKqOXOfWIDRikfc8ZB0eX3cNDfa/cAs2QmbecWFcxwVzDG3vS3w/8LuvYa0UMsCKsdL
J/Q/cVhVeO498g702PIGN9FCaMaV1aIQtCrHIOj4QYKKe2AJzbsjabj/XUWYPhESGJA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=DV8HRORm;
dmarc=pass header.from=linux.ibm.com;
spf=pass smtp.mailfrom=linux.ibm.com;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id DFA83606A332;
Tue, 24 Nov 2026 07:50:01 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=DV8HRORm
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=148.163.158.5
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1795506591;
b=GkaoOx8naMHlQxX0vuR91+B+EqnMJ3DzeaVp35rwXhh/45fJl3i2+YyIkDQeWs7/Nk2X
mHE/7LapRfMjza6fhRphkap5UUvYhZ820fbmkschNpBmWHc2ElT0jpdD+oCwGAd8KNiyM
FkOwiwm6WPO3Rks2swjl4xxrVr2D9HTuGl8nYbyD/SS9qvcOgx3EB+zPteqWAT2hKv5iu
ADTjqGijAqOPDdo/I3b4bIeiW2RckYBHPoyMvtm97BAPWROD1PVfG8Ifm2fTe868hmtrg
gEk8fpvDu35waehDE14xdObrVN1ia2xBRYEDt8SBOmknXXHw3a8qXQPKKggZqn6y1/A==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1795506591;
h=DMARC-Filter:Received:DKIM-Signature:Received:Received:Received:
Received:Received:Received:Received:Received:From:To:Cc:Subject:Date:
Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding:
X-TM-AS-GCONF:X-Proofpoint-Reinject:X-Proofpoint-ORIG-GUID:
X-Proofpoint-Spam-Info:X-Proofpoint-GUID:X-Authority-Analysis:
X-Proofpoint-Spam-Details-Enc:X-Proofpoint-Virus-Version:
X-Proofpoint-Spam-Details;
bh=vFe9+xvHMJKBNQaIgGpMM8NokfA92ua0f4m4mQbWGmo=;
b=sm+mC7ystHcD/BrVPyTHZUJoEXRZ362+IArFCDP3Nrc3rj0HoqygQWIvaxocK+jr2nGo
Srr5GAfps0g9Iq/Zcszfyc8vUtUwPsMyHlO3/6uDzdoauxjvp2ACNYyQNl6Xkl8hVMirP
yWPsJadSxK4cbIn7FjvO9M2a98lnJFDoBoKpK+y8c50We4p8DubIGkqq7WpbUB/fPjWN9
xPu1vwI8Hph+Ba/Jmwv5xPKVjgya+JvF2ceBR056Oi+W01vIM5aJxTuk+tA1NK8Iw0ChL
mcZtW19hFkqIqw4DHw3v5gozux1OAFmxV8c15dePKU0NG0A8uGGVCkuszhbcOvUonYA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=linux.ibm.com;
spf=pass smtp.mailfrom=linux.ibm.com;
dkim=pass header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=DV8HRORm;
arc=none smtp.remote-ip=148.163.158.5
X-Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 88E10606A31E;
Tue, 24 Nov 2026 07:49:50 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 88E10606A31E
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com
X-Received: from pps.filterd (m0360072.ppops.net [127.0.0.1])
by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6AO35ABN1271944;
Tue, 24 Nov 2026 07:49:40 GMT
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc
:content-transfer-encoding:date:from:message-id:mime-version
:subject:to; s=pp1; bh=vFe9+xvHMJKBNQaIgGpMM8NokfA92ua0f4m4mQbWG
mo=; b=DV8HRORm6xSuVOJ03ebYv3z/LZrpZFX2bhOysHERSKPLvqXavJK4N9FP5
W5xliBYmFC+WOx8AG9dX2k39vmLbxdL6o2LU002a56f8folkF1dS3qks6iBeACX9
9XhcfLGAYqonlrXZVzDyfkqag+bDnP7iStDm3U4yFBSX74abnbifVVT6TTF/5DN+
rG4DNQUNHTO9i669pMUrjHsan2TkoINhUeBa5Avsd2+R5UabmiQSAsn+T6EYLdSN
hVXRYDUux8/ExZhSs0j3nC+51TcCRKNyPFcdjsJB6+q/5hNDw3kOUqygM5JlG1i8
zhHTUT0tU2Aobg7oKoo1E8Q0BYSNA==
X-Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220])
by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4j34g16966-1
(version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT);
Tue, 24 Nov 2026 07:49:39 +0000 (GMT)
X-Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1])
by ppma12.dal12v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 6AO2nPIR2741045;
Tue, 24 Nov 2026 07:49:38 GMT
X-Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225])
by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 4j3nmqhxuq-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Tue, 24 Nov 2026 07:49:38 +0000 (GMT)
X-Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101])
by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 6AO7nYF728311994
(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Tue, 24 Nov 2026 07:49:34 GMT
X-Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1])
by IMSVA (Postfix) with ESMTP id 69DB620043;
Tue, 24 Nov 2026 07:49:34 +0000 (GMT)
X-Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1])
by IMSVA (Postfix) with ESMTP id 2A1BA20040;
Tue, 24 Nov 2026 07:49:34 +0000 (GMT)
X-Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9])
by smtpav02.fra02v.mail.ibm.com (Postfix) with SMTP;
Tue, 24 Nov 2026 07:49:34 +0000 (GMT)
X-Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 56341)
id 12D901616BE; Tue, 24 Nov 2026 08:49:34 +0100 (CET)
X-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, Mahanta Jambigi <mjambigi@linux.ibm.com>
X-Mailer: git-send-email 2.53.0
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-TM-AS-GCONF: 00
X-Proofpoint-Reinject: loops=2 maxloops=12
X-Proofpoint-ORIG-GUID: K59Fqsie0400o7ITTeGkzM7bzWlg5qHy
X-Proofpoint-Spam-Info: AW1haW4tMjYxMTI0MDAzMCBTYWx0ZWRfX+vbROWhBao3R
JqPpIuTQo+plpSYnvn0H8FgGAld3H9SeM9j/beS3A7tW5t9c7+QGgLOmFOpjMBP+Ku5wcoYF2Y+
5XBH0rlpV9KZj1+NT79Zm0883gN33Vw=
X-Proofpoint-GUID: 39XXvwgPrFUytP02PBzLyRN3nscuc4AD
X-Authority-Analysis: v=2.4 cv=c8M+0h9l c=1 sm=1 tr=0 ts=6b054194 cx=c_pps
a=bLidbwmWQ0KltjZqbj+ezA==:117 a=bLidbwmWQ0KltjZqbj+ezA==:17
a=zJRp6_cAMcgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22
a=RzCfie-kr_QcCd8fBx8p:22 a=e0kRlRqOptjlawYriWYA:9
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTI0MDAzMCBTYWx0ZWRfX/0hzE8k4OrOD
YOk1EKzZU6kjiUigPtdMoYVbg5nMQD4YmXDuPP2acX+0I/AB8C0kOXEpfWvgRnVuncOAPU40rmx
lOTsNiyE8o0i6JeELSUbmnloC0LeQ+dHn18mRFzI3AjElvXH7C3TYrzrORgjPLTUBSu2oXOL4eu
uT2HJDsudOwMi0eWuxi26MBU7xa25ycDmUjRttou9WSM26rwmdfyRKYShlAqHsWrWfTfLy6y6od
CxTslo0Wp3iPhTEXoqHuxSJAeNc2mYrnpYNTL1NQ1hKYXYg3F7luRJrGXOum0J71n9eeVmSSFSF
xkUtbzvDKr01JzdbH1YGgAntWuh2y/JO6/Csjt3sd2KvkT2/fdFc/nkuHCJ/4C0EK6Zy1vkQ0YC
nD6gtA/muZWd0Qg/zsUL9g9poCmRb9qOBgmuzsRcM4ErTECt6FGj20ENZ6A2MBGxZlwukk8eYAf
O1R7pzOg8JjcvSlGLNw==
X-Proofpoint-Virus-Version: vendor=baseguard
engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49
definitions=2026-11-24_01,2026-11-23_01,2025-10-01_01
X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0
impostorscore=0 clxscore=1015 malwarescore=0 suspectscore=0 bulkscore=0
priorityscore=1501 phishscore=0 adultscore=0 spamscore=0 lowpriorityscore=0
classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0
reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611240030