🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #25058

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

#25058
From: Mahanta Jambigi
Date: Tue, 01 Dec 2026 08:00
71 lines
15657 bytes

On 29/11/26 8:21 pm, willemb@google.com wrote:
> Mahanta Jambigi wrote:
>> 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
> 
> This series no longer applies cleanly to current net-next (conflict in
> net/smc/af_smc.c reported by NIPA contest). Please rebase onto current
> net-next and repost v3.

v3 has been posted, re-based onto net-next *d7f7fac1c*. It applies
cleanly there (checked with git am) and builds with no warnings,
producing smc.ko and smc_diag.ko.
Technical Details
Message-ID: <b06ce561-b5ab-464e-8e37-59ea06774819@linux.ibm.com>
Path: mbox-mo1.pugleaf.net!news-sfo.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374816-linux-kernel-netdev=dewy.ru
References: <20261124074927.3622245-1-mjambigi@linux.ibm.com> <willemb.3b7ecba3698bb@google.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-sfo.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374816-linux-kernel-netdev=dewy.ru
From: mjambigi@linux.ibm.com (Mahanta Jambigi)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v2 0/3] net/smc: fix clcsock lifetime vs
 asynchronous paths
Date: Tue, 1 Dec 2026 13:30:51 +0530
Organization: Usenet Network
Message-ID: <b06ce561-b5ab-464e-8e37-59ea06774819@linux.ibm.com>
References: <20261124074927.3622245-1-mjambigi@linux.ibm.com>
 <willemb.3b7ecba3698bb@google.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1653739"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:eSbPUNTOw+9mY6DGGiXQNk9Vmpc= sha256:9ULQhHqSgYibMD4RxM9OM4NPXFBRU0eEA9gnp4cjY3w=
	sha1:1AR+1s9OBwve78o9qHvYaP475F0= sha256:gnYWrAWeTWJ0vh4jCLRM7f8uijw6qFkL/japHld+7u0=
Content-Language: en-US
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 57C4A1172B0; Tue,  1 Dec 2026 11:01:27 +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 YgNN0-3BEkon;
	Tue,  1 Dec 2026 11:01:24 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-374816-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 7AA711172AD; Tue,  1 Dec 2026 11:01:16 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id 144B3601E7B; Tue,  1 Dec 2026 08:01:16 +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=1796112075;
	b=HWMvDya+mRwoqM+qMHuDhNRjM0smM4fcWwJZudDtkv9QpklQ3DR8aMKgqWio2ACPFUys
	 FE0tPfhtl9BvhzvXuu+w3PUDxGFMjtiAJo9X6z4V7BJM5MQHEmW9ZlEA/Up6d4SW0jeZs
	 3wKyTIcG5dvFl9rWvt5gNkhBPXFTI50hhTZIpRVNcgFbomiHyiijLiQ25HIRk2INyA+uL
	 QRh81/Z+sv9RSey/kr0QjmoCIqUrCnUN4q/Sm7VP5ALgSxjl0srEWQ0qNPun+OBX2YSZq
	 r11TvAIynW0cFoosY0w+M/45ePdusU0zngEyvPVjoQ+fZpby6PNy950M2Hn6mWlW52g==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796112075;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:Received:
	 Received:Received:Received:Received:Received:Received:Message-ID:Date:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:User-Agent:
	 Subject:To:Cc:References:Content-Language:From:In-Reply-To:
	 Content-Type:Content-Transfer-Encoding:X-TM-AS-GCONF:
	 X-Proofpoint-Reinject:X-Proofpoint-GUID:X-Proofpoint-Spam-Info:
	 X-Proofpoint-Spam-Details-Enc:X-Authority-Analysis:
	 X-Proofpoint-ORIG-GUID:X-Proofpoint-Virus-Version:
	 X-Proofpoint-Spam-Details;
	bh=Bd3c4GmlXfjm5xDb3J5IsGj7DO8x2rhcUNbz007bSGo=;
	b=wyZZtHNqwgBz/QOck5xUWkU4hEMW5/cR0IgjO9LKr3FkyVI/yJ30nYsI5KP2DscJ3VEI
	 Nq4NVt+nYkLmmuDfVj8Sc2qBujR8nP0TpHwlUp27lQvxVKyq5VnQj5stli3j6Ps9YkUTZ
	 srOFm3lK8DLiZfgypAQPQCg9CmGu5FFDcDD1Lp6cjUlNrlDsOt74l9hV96UpqIqQAV3+C
	 OFyiSjrc6olFRDnBvU8QaPb4v7vMrk3uZP0UApnpT7z1dtxcT7afJGr8IdyLlW0vQxEgU
	 WVIhbl/9r9FtbzVmwqyjUFKYc9fduO09a9D7tnSz/Mttrq8JlnAQLw4PXKaBfvPK94w==
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=npVmFU8l;
	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 209E5606A32E;
	Tue,  1 Dec 2026 08:01:15 +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=npVmFU8l
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=1796112069;
	b=F7y/u6JaiZI/Ea/bNZLzOe7lW/cZzLbAwBgNddEQKlsGOdHoFuNy9ylsiwKDvziqxRhx
	 jed/+SsaUTm/uO+9Fs7zm0JpxBywrtxdCjhYBFtmlLn3yxwR1Ew8vNoYOc8ggkEJCjPMJ
	 V2hfaNVrGbSkARe5aG42Z600/pEjig3b4APakOMMXuIkmZ3VlGX+uUXiayCsl0etm8jUN
	 oj83IONWuVvJ+qXhXnahM6vAtJyoNwva34qel9oCU0Rz/8omDxbcGuaRxA6ulLQwtwPi7
	 201ANx68LDpjUFrhqMfsg9UHpTxg4ztYbBmOab6DijvjhkOmdNiwetQqd/2+0VcC+SA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796112069;
	h=DMARC-Filter:Received:DKIM-Signature:Received:Received:Received:
	 Received:Received:Received:Received:Message-ID:Date:MIME-Version:
	 User-Agent:Subject:To:Cc:References:Content-Language:From:In-Reply-To:
	 Content-Type:Content-Transfer-Encoding:X-TM-AS-GCONF:
	 X-Proofpoint-Reinject:X-Proofpoint-GUID:X-Proofpoint-Spam-Info:
	 X-Proofpoint-Spam-Details-Enc:X-Authority-Analysis:
	 X-Proofpoint-ORIG-GUID:X-Proofpoint-Virus-Version:
	 X-Proofpoint-Spam-Details;
	bh=Bd3c4GmlXfjm5xDb3J5IsGj7DO8x2rhcUNbz007bSGo=;
	b=LlvSGqQ9IciOmWNcEpXO+a0rpGk0jK9YH8rKv1IIg9C6IwjFXtaNFFq8H7mNLBodgXVH
	 zZAxgsFWRzK+iU5Q8SOVWRskHHIGMsKeUENvB7wjTSo4fQ+CcgeBGdKkIACV3z/spb6cj
	 +sWe+NjqZKo4b4tdIMP0wW3m+3AoqEoSbz/KtaIAq1v1A2eWBsOjDeOJi3Wd5GiEmU3LD
	 H0m0E8icaB4LkVlYH55B9qamlRdH+tYYKRc5aKRDqb1XZ/ovwbXgdLYVsheQrmnRs3yHO
	 O5g2jJA1KaAPGz02MxA+kD1kOWapVmizSid2+J1aPDV3JBU0XgUMebQUczq9p/LKu6Q==
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=npVmFU8l;
	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 D4AB8606A31A;
	Tue,  1 Dec 2026 08:01:08 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D4AB8606A31A
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 (m0356517.ppops.net [127.0.0.1])
	by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B12Zt9a645951;
	Tue, 1 Dec 2026 08:01:03 GMT
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc
	:content-transfer-encoding:content-type:date:from:in-reply-to
	:message-id:mime-version:references:subject:to; s=pp1; bh=Bd3c4G
	mlXfjm5xDb3J5IsGj7DO8x2rhcUNbz007bSGo=; b=npVmFU8lGm8iU4t0ky8MP9
	CLdd54b6trkGsBE3+U2Xm38xoDw7zj4L0GpkFIboenteYNeDI4T+KKAlzl1Fxrel
	D8OiOkDr9nUbHPXomJcWLg0UaQHEjISpGT9LH6eg3KTNUeBoXmgeWEh+7C/oMkvR
	WO+9FnMw5NqROZl98TYpfVjKLil7ouFuvQvA8cn7XJvXczepVy0NiE9Al9MQNt4s
	7B4vvfkYT/pq0UMSAu6XEcD2Mut+9lndwO5QeJ7cMO5PrTSQB887m7JcsyBvpITR
	MY9W7toLMH8fH0OMMsWNp8E7a3v1qKravaYzqQV036ejHsr19meVBT9y8LjmYK8A
	==
X-Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91])
	by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4j7pp5unky-1
	(version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT);
	Tue, 01 Dec 2026 08:01:02 +0000 (GMT)
X-Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1])
	by ppma21.wdc07v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 6B17YuLg2305735;
	Tue, 1 Dec 2026 08:01:01 GMT
X-Received: from smtprelay04.dal12v.mail.ibm.com ([172.16.1.6])
	by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4j8a9k0aga-1
	(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
	Tue, 01 Dec 2026 08:01:01 +0000 (GMT)
X-Received: from smtpav04.wdc07v.mail.ibm.com (smtpav04.wdc07v.mail.ibm.com [10.39.53.231])
	by smtprelay04.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 6B180xqi24576540
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
	Tue, 1 Dec 2026 08:01:00 GMT
X-Received: from smtpav04.wdc07v.mail.ibm.com (unknown [127.0.0.1])
	by IMSVA (Postfix) with ESMTP id ABAB55805E;
	Tue,  1 Dec 2026 08:00:59 +0000 (GMT)
X-Received: from smtpav04.wdc07v.mail.ibm.com (unknown [127.0.0.1])
	by IMSVA (Postfix) with ESMTP id D092758050;
	Tue,  1 Dec 2026 08:00:52 +0000 (GMT)
X-Received: from [9.123.8.233] (unknown [9.123.8.233])
	by smtpav04.wdc07v.mail.ibm.com (Postfix) with ESMTP;
	Tue,  1 Dec 2026 08:00:52 +0000 (GMT)
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-User-Agent: Mozilla Thunderbird
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
X-In-Reply-To: <willemb.3b7ecba3698bb@google.com>
X-TM-AS-GCONF: 00
X-Proofpoint-Reinject: loops=2 maxloops=12
X-Proofpoint-GUID: _OJFobRMFT5WEoXXQ4rnhq8NPQzhp6-r
X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAxMDAzMCBTYWx0ZWRfXzVdI4/ax0q1n
 Hzg7450v2fmjxS68s1cFZ5mb1j7+JNDsCPd20uimAouYa7qOMXeyhJGk0zrzjDJ0DiHwX3tVW4Z
 c8ROgEeEyoBF9PDFHrwMk387yMGrHjI=
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAxMDAzMCBTYWx0ZWRfX3sVL8GzJM/P5
 i9EGTgRqYsJRONlB8dQp/qEDXHLZjHmJU4rOdVJM02kLIwH1PlCsqVoBqlHDbSea+W68tYySLnT
 +CpO0LvUwtOHldYftPH/SNpdZiseQePSTmcOMwfmDcRy+aEDoQ8P1JQ7KXv3bed/HBYaxEpTPbd
 FaMncJdbtafXluQOABH8iYYwHG3SXUH7Q7U1aWUnEmh57N6RU4oh+Kw6R5/qUVo0oghUFX0HOO3
 eftbNWeD8xNNtwOKapNqSgQYG3qx/Rm9ndeE6WpICryYKZMhP3iCsvsQ5Yoj35xIm552ovnKOUr
 L5fuiDbS1cyTc9gJpZAHZkfThg4yCnqOG0HBEgH62V1a8IB91hEshHaijwzJehOhCjt2GTK3/xN
 uBOT9kVZ6lJzkCPSXiGOvXNIx3YN2eozBingTDrofcmKsUQ09mscuJLBQaXRXTRIYwLxBcTJW87
 ONLE2vc0zwGWTSxc+dg==
X-Authority-Analysis: v=2.4 cv=Ae8kjHXG c=1 sm=1 tr=0 ts=6b0e7ebe cx=c_pps
 a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17
 a=IkcTkHD0fZMA:10 a=pUM-KoujPXoA:10 a=VkNPw1HP01LnGYTKEx00:22
 a=RnoormkPH1_aCDwRdu11:22 a=U7nrCbtTmkRpXpFmAIza:22 a=1XWaLZrsAAAA:8
 a=GBLbv43cW-JElwczKWoA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10
X-Proofpoint-ORIG-GUID: voKi8F4TizUICisS8XDzc1gXGAHl605u
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
 suspectscore=0 adultscore=0 spamscore=0 malwarescore=0 phishscore=0
 lowpriorityscore=0 bulkscore=0 priorityscore=1501 impostorscore=0
 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc=
 route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001
 definitions=main-2612010030