🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #19807

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

#19807
From: Mahanta Jambigi
Date: Fri, 20 Nov 2026 12:45
48 lines
14284 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.

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(-)

-- 
2.50.1 (Apple Git-155)
Technical Details
Message-ID: <20261120124534.430200-1-mjambigi@linux.ibm.com>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.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-367935-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.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-367935-linux-kernel-netdev=dewy.ru
From: mjambigi@linux.ibm.com (Mahanta Jambigi)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next 0/3] net/smc: fix clcsock lifetime vs asynchronous paths
Date: Fri, 20 Nov 2026 13:45:31 +0100
Organization: Usenet Network
Message-ID: <20261120124534.430200-1-mjambigi@linux.ibm.com>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="3159079"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:13zQtXvAayXtBmh39St7cVh0+FM= sha256:TAZZkWEjlycGkpKkjX0XEZ68L3sSi2NU0OX82/Tcs9w=
	sha1:UX2dXF7YkJcbK9ZAufFOxYOwjM4= sha256:pbkdIxiNDo732XE2VXS4ar6PJKPOQPgpGazdSjJPWJA=
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 2595A11599D; Fri, 20 Nov 2026 15:46:29 +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 aMbDHCQbEk5a;
	Fri, 20 Nov 2026 15:46:22 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-367935-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 A159011599B; Fri, 20 Nov 2026 15:46:12 +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 4577E3FAD9; Fri, 20 Nov 2026 12:46:06 +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=1795178762;
	b=r4iBZVJQCOEDWka+KKw4Rb3RSNzs2QXCasik81WEUm4kTjjh+IYAyGfaLGdFj5IIw4oI
	 5/weH4mxyjZDJgY0g0xwJp1JZqzqO6UhVieomEmMWQ9A9Z724W4NENCXUfo0iyMnr/95K
	 vyTSlwErpD+rUftgKRS7ZfxTECaTbDt2UxRbsnK9jk5BDcqYiZRpYqcVW6M1ALA2VdyOU
	 1qoVXVVlCEFpLrChMNQR5jqu2ZVQFbNkflQDVL8JG+dTQL7P2iIt89nCiGo8R+0N2A7Ay
	 ayBEa4TkEGBxa+siF8wJzi9uAcgnnJnEDuQ1KzWPpRXzfbpxondxtAcNnOIKlBBKjhw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795178762;
	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-GUID:X-Authority-Analysis:
	 X-Proofpoint-Spam-Info:X-Proofpoint-ORIG-GUID:
	 X-Proofpoint-Spam-Details-Enc:X-Proofpoint-Virus-Version:
	 X-Proofpoint-Spam-Details;
	bh=A2lctlwYtriSyDX+8a84R0H8qTM0RWQIPGwcyCVle44=;
	b=zGvPxLHwA6B/lW63sdhRGuTv1VuLs59tZPHIPLWviyFxtZ/dvE2rn21x/2WEoGnbSD9G
	 NabBPdZsMJA8+hDXJ3fKcj9t2nZn9dQBXFI06WB59tIuxNiEyXay1agoDe9p7rqmt/60d
	 42J+q4M4JVkYXB8btHYKTqxlOIjHMfwdYKow4D11lG46TETKJ/vTdgwzcWHVgQ0PZpco8
	 7W9tCtPTKCJuqhFqQypjGyId/FV4v+Xzg0mAmOoBCNHDMdQQDBg0wgu6e7QdNw42Cxb8I
	 9UJ9FzBwx40KhL6MIcbjnT/jsUPD3ElWz695wapUKcjWMnqpTA7Q1p6dZkurGKWRZsw==
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=tY7PS0GB;
	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 855E260A2605;
	Fri, 20 Nov 2026 12:46:02 +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=tY7PS0GB
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=148.163.156.1
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795178761;
	b=3f+zdW2Cv037Ekk4zzb3Bwg/qxb9iJIw5cmip2EbeHBUzpTblxlaVerULXCZV+Ojy2Nd
	 PZ+xmA3U5xwHO9xCGYhi/FHSYKx5kADKMzb7/F6H7Xv0BA3OI777ZqZE1NbK608w2xO1I
	 bMlrteUBqLGAv/JsITj040nn/Cv5dXsjmXq3r4HR5C1OHvYK5qKTH6aPz+B7p1q5lnCNV
	 DPU4NyYRi5Xz4/0vIPKX0UzbLdCDoPDmfg0qUsU5pBIWLvfwwLDQ/x7vWuXxq18UET6Uc
	 81RuZDKrz3XikRhfI0HwnOJ752zfkiPlPn39ZodNH+Qb1/1M4N23x7AdS1f0/S3s4fQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795178761;
	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-GUID:
	 X-Authority-Analysis:X-Proofpoint-Spam-Info:X-Proofpoint-ORIG-GUID:
	 X-Proofpoint-Spam-Details-Enc:X-Proofpoint-Virus-Version:
	 X-Proofpoint-Spam-Details;
	bh=A2lctlwYtriSyDX+8a84R0H8qTM0RWQIPGwcyCVle44=;
	b=DPZ/aAkUtxFBfWjqS2mGi+Zx++Lj/7+qgedbKIGuYIVPnNEvrdbhu39qmzGA6hI2gBeb
	 yguPKmvmgI1wfGLIhlxFfIZSGPDwU8noqNxrMCZCyuXGXW8j9NDuqQ1Ve69e1gE2v2Uh+
	 hA2VQYAojMQ6qvs9uhIP2/AyMmhRdQ/lcFMOf3w0z/FbHIMiiURt7ZukbpAuIfZefuI3m
	 hFu0qU7JMv8zeqDYObl9gdazsQrGIivyxY4RE0eJ+T2ut2sqExC98sHI5F/qPIDBnghLI
	 sgVrCFR64bJpbXx2HzgxdnQgjiQSEUYDxP6QhVSrH/SwIwD00xVtOxRCkeTYLihnK9Q==
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=tY7PS0GB;
	arc=none smtp.remote-ip=148.163.156.1
X-Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1])
	(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 47D74606A33A;
	Fri, 20 Nov 2026 12:46:01 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 47D74606A33A
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 (m0353729.ppops.net [127.0.0.1])
	by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6AKAu3Mn1243432;
	Fri, 20 Nov 2026 12:45:45 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=A2lctlwYtriSyDX+8a84R0H8qTM0RWQIPGwcyCVle
	44=; b=tY7PS0GBnH3GsZI3wxTsdaWVYxVn9u+b+nj7EwcHQXvRrJGtJWAVr4EWW
	qybRDbyW+ljRDUWEco8JsIq5lQY8DrJgu3Raz0ouNCEBclij6eDa4J5FvIGFvs7f
	kaHO7Xzs687axR7B6/Cf0HUcNcTJbbNBV+ZZflq4bkMdmdgHiLCV5a8aPjzi/bsJ
	S16zAsXlM4z/ABTu9zFEz05M2cMJwn2o9pPfXSQ1W0BbgRBoDZVk54AIRsALKqhj
	nmYN9vivWspFjiuwf2OLc5xOb8VTptwlkHfyDQ1Wi7yjcZyH7d1PV/2Ovz8VQLZ5
	35PCWtCPu3HVbUl7nyJgW8/hhmK5A==
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 4j105s0dky-1
	(version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT);
	Fri, 20 Nov 2026 12:45:43 +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 6AKAo6EY4130935;
	Fri, 20 Nov 2026 12:45:43 GMT
X-Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225])
	by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4j1v9xg2k8-1
	(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
	Fri, 20 Nov 2026 12:45:43 +0000 (GMT)
X-Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100])
	by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 6AKCjd5r51904828
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
	Fri, 20 Nov 2026 12:45:39 GMT
X-Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1])
	by IMSVA (Postfix) with ESMTP id 4B3262004B;
	Fri, 20 Nov 2026 12:45:39 +0000 (GMT)
X-Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1])
	by IMSVA (Postfix) with ESMTP id 0E37520043;
	Fri, 20 Nov 2026 12:45:39 +0000 (GMT)
X-Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9])
	by smtpav01.fra02v.mail.ibm.com (Postfix) with SMTP;
	Fri, 20 Nov 2026 12:45:39 +0000 (GMT)
X-Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 56341)
	id EAC02160DEF; Fri, 20 Nov 2026 13:45:38 +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-GUID: mVajBoqCZhyOBC6PnndldJlMHu3zg39k
X-Authority-Analysis: v=2.4 cv=e8uT2qp/ c=1 sm=1 tr=0 ts=6b0040f8 cx=c_pps
 a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17
 a=zJRp6_cAMcgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22
 a=uAbxVGIbfxUO_5tXvNgY:22 a=e0kRlRqOptjlawYriWYA:9
X-Proofpoint-Spam-Info: AW1haW4tMjYxMTIwMDA0OSBTYWx0ZWRfX23UL19bdfffL
 DGM1z4haIrBM0XDxvcmEpI3q/pb0+4YtKRwm6YYH0PcHAy0T5sCKjDaPUfD2wkszyQGJ18akxT2
 dehgC80hO6dyrbJhEG0fbdtjdNwWFcU=
X-Proofpoint-ORIG-GUID: qZgiATnaRMkBQYwKYJw5La-BgKnNtvNj
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTIwMDA0OSBTYWx0ZWRfX1YIM50WSNLkn
 XYNp8wy5fe0poHBh/DfyJ4nvXn9UZqt717gPrGoEdGenBTE+/Jfxc2yLYevsULUHlFro8dwS9MT
 GC9vdD+tuw6AgIFgUFkcJpSGQYkzs9bjic+F6Bh0s03wUpVWfc3U0tkuCRQm6F401vj1p/Fe/tJ
 OVFpD5zaooPY9uE+eumwuBZIAe4pXVF/+h/l3N/81II+zbSAA3FPP+UCyDXkUe4Iv1wVNVSPKqb
 7CO2j6wMcUPFiUQP4Jcb6LfuOMioLFVvAjowdxIYD3EaY+qP6rxM4nX9ki6RlRe2sgyyVJWgyCs
 nnXcsZAraDDzWYqcwNqWPHtMMor7xWwwIpLQptcjrRQUMkpNvARWVEvB++K4Vjnmxo/D1uzmqKk
 RWefYbsVUwCRz4oUda6VC3ONOwNLKctvlidzviT6jKr5mphHYzhTVNYbU0o9d1l7+zm0o8qOQIq
 nqRgxmruo0MTRLpZk1Q==
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-20_04,2026-11-19_01,2025-10-01_01
X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0
 clxscore=1015 priorityscore=1501 suspectscore=0 phishscore=0
 lowpriorityscore=0 adultscore=0 spamscore=0 bulkscore=0 malwarescore=0
 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc=
 route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001
 definitions=main-2611200049