🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #25053

[PATCH net-next v3 0/3] net/smc: fix clcsock lifetime vs asynchronous paths

#25053
From: Mahanta Jambigi
Date: Tue, 01 Dec 2026 07:58
66 lines
15210 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 v3:
- Rebased onto net-next d7f7fac1c. No code change; the diff is
  unchanged apart from hunk context, and the series applies cleanly
  with git am.

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: d7f7fac1c3220a430559c6d43904e27917ae1eb0
-- 
2.50.1 (Apple Git-155)
Technical Details
Message-ID: <20261201075815.2159547-1-mjambigi@linux.ibm.com>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer04.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!peer05.ams1!peer.ams1.xlned.com!news.xlned.com!npeer.as286.net!npeer-ng0.as286.net!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374811-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer04.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!peer05.ams1!peer.ams1.xlned.com!news.xlned.com!npeer.as286.net!npeer-ng0.as286.net!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374811-linux-kernel-netdev=dewy.ru
From: mjambigi@linux.ibm.com (Mahanta Jambigi)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v3 0/3] net/smc: fix clcsock lifetime vs asynchronous paths
Date: Tue,  1 Dec 2026 08:58:12 +0100
Organization: Usenet Network
Message-ID: <20261201075815.2159547-1-mjambigi@linux.ibm.com>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="1652492"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:c6Iqsh5C9OQ7jZFEiMcLaKvxhuY= sha256:Uo5yolbq/AWi0BnUjg4QY4YpfjC5wnN2q0KzBeyvZFQ=
	sha1:iYD5jviuaYJeF4MV6MG7j+DFLc0= sha256:vzDLfZcLV9vEi6sBNK3rFV1t9tuJGfgya5pqleWGZQI=
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 23D371172AB; Tue,  1 Dec 2026 10:59:06 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.051
X-Spam-Status: No, score=-3.051 tagged_above=-9999 required=6.31
	tests=[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 Y1e8Gw4Fm_pM;
	Tue,  1 Dec 2026 10:59:03 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-374811-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id F21671172A4; Tue,  1 Dec 2026 10:58:54 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 3045526A53; Tue,  1 Dec 2026 07:58:52 +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=1796111929;
	b=Vh4+5SNmC0Qwx/RYcMu5U5NVutqcEizac0FDSzkM2ioNGAJJq6EfIezfjCRDdMgc+wkk
	 wW2Rx66B3BRAIBy0TBUG5T8l5lsjNSjOlDDiByqfrsfY26D0AFG5Y7XxFy7fbGuXoupAp
	 mApRgN9YbxVv1ycyBDv4INyfWbqSOuqby9my7eQHa80/095lBgcrA9OU0N+dzQl7HbyPG
	 Xk9hAnkF+DE7YHjx9Hg7aLMApjGstXnDW2AJnahrq3TSjcx0k5/7bhZ3XHgBGiG+x+7NA
	 TqXR03y3QSLe6FfFOBUKxc1Lw3vHkJ20zy6teN2/09m4YmBfHe4/Uh2QCz5NF36mGEA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796111929;
	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-Authority-Analysis:
	 X-Proofpoint-Spam-Details-Enc:X-Proofpoint-Spam-Info:
	 X-Proofpoint-ORIG-GUID:X-Proofpoint-GUID:X-Proofpoint-Virus-Version:
	 X-Proofpoint-Spam-Details;
	bh=4Kq9gp++LfbZmlIQp/6LCiw3gj3ITBrevfOCz7rR9G4=;
	b=o8Hgdtg5XwPGinjLXCivxEHShNY/isPkVkStIUsbieyrYKCgZuEIsWzSkbnhnXy4fx7r
	 tL14WBjK3NtSTM4c0X8jrRhrtVgxMu3soT67Di6tLnpkxvkQaxUCwfZa4byvoESys+zJ9
	 uZQHGNS8+8TvRXl26Pk+XSqsQFaAayBgGv4Da0yZrRq35wo2hP6nffUN8twxc6CD7bQ0O
	 FbXOdxIw1DVfnCVOM/aeZ9zu91P46InTpm7OMvecmVjmYUl4cIA/ZQyzSaf9SFqmxg1QQ
	 gxrkhsE8ObNAsKzqsONVU3UanwpODJkgTyuNICe/aH/oBTdFTIne7KhBdBqfvDX3bBQ==
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=YqDNJO9B;
	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 0111A606A331;
	Tue,  1 Dec 2026 07:58:49 +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=YqDNJO9B
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=1796111928;
	b=4NvKxd5lxMmwZgwSfpLu0mGpz09CgqCUStsq6StjXNCBfoT+W+jR4l+sb5nD6e8jg10O
	 /yeCqQifzXxvOTnlWiDGVajMjMNQoNA9D38kNpf7Hsu3ZuVOG4ftT3GzNhF1I9ye1Xmyn
	 GBzh4Zwqhr56/RZqzocP4AaXVbg55XK259sI7BahPr4OxBxWZWsZ5WkEJ5wMCbpZ9VNUi
	 j7C9OHMEk//TdyT9WhvVWeLv8oTs5ZN/UDm8QbJUl4VZ+bDZzsLUIvKkmfBdYY3PnAVgG
	 6eNOW1B++ifYkGWG9VyFz6wxl2VHhgxHlEKrDQ5Jn/l4HLvqLq+qa/OqEEHSzi80DBA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796111928;
	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-Authority-Analysis:
	 X-Proofpoint-Spam-Details-Enc:X-Proofpoint-Spam-Info:
	 X-Proofpoint-ORIG-GUID:X-Proofpoint-GUID:X-Proofpoint-Virus-Version:
	 X-Proofpoint-Spam-Details;
	bh=4Kq9gp++LfbZmlIQp/6LCiw3gj3ITBrevfOCz7rR9G4=;
	b=b0C1cmPzMENcZ6UonB7hhEyv6NBsaRbxWWbEkyNmudjLdogQLsbcDQkd4jgQmk8ohD86
	 c1diNfDqMnvOkqX7EL9Xrwue5DVQOK+PiA7fZi3FC9O0mOXClP11vPByFaePFdyt8XXjp
	 O0BOqpyM3KK2d6CpNJGh6BmUFfxXVFAyHZ8lBixrfqIj25a28gOmPBZvS6nqI7YtxHxKx
	 JW0+TghWssJnrQLZX+71zveRs99MwckpWDB0SdAbm2MYXy81YcDalTXrc0f6VsI2ImuF6
	 eHlOsnsfXjw7/qLYuhpYIGzYKquzK969epQ5WThfSLAca3wIwlVEAE8vfKSn8AoFbbg==
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=YqDNJO9B;
	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 9BDB1606A31A;
	Tue,  1 Dec 2026 07:58:47 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9BDB1606A31A
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 6B12Z1l8640314;
	Tue, 1 Dec 2026 07:58:32 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=4Kq9gp++LfbZmlIQp/6LCiw3gj3ITBrevfOCz7rR9
	G4=; b=YqDNJO9BgEJyhwi5EyBYznUZDFyuKX5WaJ/fSVvLiGIy22bocnn9FldLI
	AYG+5JIzYfm11w6ltbBAxmJOwgW5/eaBKPbGJwmhKIfy3Tigcogo3LP1YNTu1NmX
	77kJZZ1UH4H4xOQgB+QaFHTqrBEmbF7/Bw83V4FTfTjbuKAIlsAuUeOShP1jQUSc
	NWYpfW4HYoYxZjRTKY1dw0PTfJFz5K2hasDciP2TzGnbL1EIMRmYHrRVO0mr3jT5
	wNkbhz3HBbUm5gKP1HN5zJ++pJErnjDpXor/MUbxkCL9WV3irDNKjAh4AZLbtETp
	5VQHANeOMOe5ulSLllZrrJsa0WLzA==
X-Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221])
	by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4j7pku33fr-1
	(version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT);
	Tue, 01 Dec 2026 07:58:32 +0000 (GMT)
X-Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1])
	by ppma13.dal12v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 6B17qagD3950095;
	Tue, 1 Dec 2026 07:58:31 GMT
X-Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227])
	by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4j8bggg3pm-1
	(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
	Tue, 01 Dec 2026 07:58:31 +0000 (GMT)
X-Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102])
	by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 6B17wRcw49283330
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
	Tue, 1 Dec 2026 07:58:27 GMT
X-Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1])
	by IMSVA (Postfix) with ESMTP id 822982004D;
	Tue,  1 Dec 2026 07:58:27 +0000 (GMT)
X-Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1])
	by IMSVA (Postfix) with ESMTP id 4E2D92004B;
	Tue,  1 Dec 2026 07:58:27 +0000 (GMT)
X-Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9])
	by smtpav03.fra02v.mail.ibm.com (Postfix) with SMTP;
	Tue,  1 Dec 2026 07:58:27 +0000 (GMT)
X-Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 56341)
	id 359F316086E; Tue, 01 Dec 2026 08:58:27 +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-Authority-Analysis: v=2.4 cv=KZZHIgYD c=1 sm=1 tr=0 ts=6b0e7e28 cx=c_pps
 a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17
 a=pUM-KoujPXoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22
 a=RzCfie-kr_QcCd8fBx8p:22 a=e0kRlRqOptjlawYriWYA:9
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAxMDAzMCBTYWx0ZWRfXyeDIoKSswrPW
 EsCIxareKHldF3xd7x/Wuvch7H8yHX433pJZ5CLMY02zO6yl1AvItCpZhNHSUdSfX+bhgdv/TvJ
 5wlB9huPCzEyJy+Lj8YnqEbP32bu9gN1MdbAhqASv44xqLe0jtIOZ3Hvn8lLJXpUFvIrWmQV/FO
 k+ChZ+b3amwpGL/ii+fXLk+N4E3cg09MJb3F5Irb8X1K4bumpxIsmeNoFdtllp7Lvki8OctatbU
 vTO0WDViCLSXkDjCQ3NfIYUWbMeYowL/sOZQ3TzgmZ5pxb9089UB38BmJQ2ChliwIEX4a/n9X+/
 A3bp69ULq1k7LjdSqEPIc7RY1yo+IXBXbvSq/3hHLTNPojGNZRd3mQr8Ok2Gccn5WzpNtNQGMkQ
 SEn6EYNhWwams0mYlln9Ow50aD+5QaX/Ubqo5CCBINvJhoELh8qU8P73sFguwtlXUDPG1UdikMm
 PS+DWcW5CfYtWkHXHIw==
X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAxMDAzMCBTYWx0ZWRfX7wzVzCB58QEy
 l2/IK1mCaT7RQDN2OEjH2DUvusPr5qDYphu9rFz9lhzk3kMALjidy2K1VkXUi4gtrku1jWTkVUI
 ywZ4M302ectM+iLBuqZKv48XbmRhaiY=
X-Proofpoint-ORIG-GUID: j57mNJ2Ofo520ql3pohdIV2Ydq4b3EGu
X-Proofpoint-GUID: Y6gdwnlPDpdfhkhrXW6n2K_OVMiMus7E
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-12-01_01,2026-11-30_01,2025-10-01_01
X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0
 impostorscore=0 bulkscore=0 malwarescore=0 adultscore=0 spamscore=0
 suspectscore=0 lowpriorityscore=0 priorityscore=1501 clxscore=1015
 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc=
 route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001
 definitions=main-2612010030
X-Received-Bytes: 14938