🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #21505

Re: [PATCH net] net/smc: serialize clcsock release against CDC receive path

#21505
From: Dust Li
Date: Tue, 24 Nov 2026 04:25
28 lines
9914 bytes
On 2026-11-23 19:21:06, Qican Ma wrote:
>In smc_cdc_msg_recv_action(), receiving a close or senddone flag writes
>RCV_SHUTDOWN to smc->clcsock->sk->sk_shutdown while holding only
>bh_lock_sock(&smc->sk). Meanwhile __smc_release() drops the socket lock
>and calls smc_clcsock_release() (which clears smc->clcsock and calls
>sock_release() under clcsock_release_lock) before calling
>smc_conn_free(&smc->conn). Even on paths that call smc_conn_free() first,
>an in-flight SMC-R softirq that already looked up the connection in
>smc_cdc_rx_handler() can still enter smc_cdc_msg_recv() concurrently with
>smc_clcsock_release() and dereference or write through a freed clcsock.
>
>Free the SMC connection before releasing clcsock in __smc_release(),
>matching smc_close_active_abort() and smc_close_passive_work(). Because
>smc_conn_free() sets conn->freed = 1 while lock_sock(sk) is held and
>release_sock(sk) synchronizes on sk->sk_lock.slock before
>smc_clcsock_release() runs, checking !smc->conn.freed under
>bh_lock_sock(&smc->sk) in smc_cdc_msg_recv() guarantees that no CDC
>handler accesses smc->clcsock once smc_clcsock_release() can start.
>
>Found with an LLM-assisted code review tool and verified by inspection on
>v7.4-rc4 (b6a9fa34ce4). Build-tested only; not runtime-tested due to lack
>of an SMC-R/SMC-D setup.

This fails to apply to net/main

Best regards,
Dust
Technical Details
Message-ID: <awURtCvesMgSBQY2@linux.alibaba.com>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369994-linux-kernel-netdev=dewy.ru
References: <CA+OT+OPkNsk2QHczVmb6KVJ+z_1tpH9DXm8JmACc5E6x-YFwPA@mail.gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369994-linux-kernel-netdev=dewy.ru
From: dust.li@linux.alibaba.com (Dust Li)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net] net/smc: serialize clcsock release against CDC
 receive path
Date: Tue, 24 Nov 2026 12:25:24 +0800
Organization: Usenet Network
Message-ID: <awURtCvesMgSBQY2@linux.alibaba.com>
References: <CA+OT+OPkNsk2QHczVmb6KVJ+z_1tpH9DXm8JmACc5E6x-YFwPA@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="4050156"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:/RdsP/eOEHOK60wVEz+48ZmmBYw= sha256:PfYxO+4YBvAlS/wfcGrYc6b1ILa6oLley7Faw4gJbn8=
	sha1:hNdXalNILw5ymi7PJbaCaJ9G9dk= sha256:kaexTr0Co20tCG1mw5TlpP9yIJ+yu4LfkZ1R1DPyFtE=
Content-Disposition: inline
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 672BF125DCD; Tue, 24 Nov 2026 07:25:54 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -10.55
X-Spam-Status: No, score=-10.55 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-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, UNPARSEABLE_RELAY=0.001, USER_IN_DEF_DKIM_WL=-7.5]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
	header.d=linux.alibaba.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 BlZlJ2c8qFPI;
	Tue, 24 Nov 2026 07:25:51 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-369994-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 9EB7D125DC9; Tue, 24 Nov 2026 07:25:40 +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 2E2F42330E; Tue, 24 Nov 2026 04:25:38 +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=1795494337;
	b=GFYbe0Oujo+TP0U3hjSveUeksUKODdFIek+XCEcrFuZvL24g8OONyDMXo+wvlOEnpJ1B
	 rSb3XOjR+w7WuAzdOLd0LS6rFNaiF6kPimFjRrwDoadqxCEEfI2w8cWFxf3UuPJXjVXm8
	 QOCgWL54NLcWyAPwBQowPKQe7GEJYVX2FqDvjcuAwQT52x3zkb8YV2QSyG/WmiJtDBw7G
	 llZgE7iBUCd4+d9TqR2NtFYF0A4hHtZqMY3wdN0x7A4/xONVQviAe8zpB1/XtO+71arOI
	 STH7aXIzr96OlSFrM9hEF4Kkw4MH8MmtACgv6323QRWD/Bfh6KjMZLXblKM9s0B72FA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795494337;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:
	 X-Alimail-AntiSpam:Received:Date:From:To:Cc:Subject:Message-ID:
	 Reply-To:References:X-Mailing-List:List-Id:List-Post:List-Help:
	 List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Type:Content-Disposition:In-Reply-To;
	bh=OEh0PEZT89NLtHRlSYqxwc0geCRim/3SLGx9Dh1iylk=;
	b=KoTDnV9UsbK35pkSV2FgnOiUJveioUbFTtrVVDggdPCNcoXeGmsI6u0JtXki3VZP5NCb
	 pJA2B7hJoX45VlWowBfXh566JCaHVPQ0b1sBf21B2ZwaimZwek/HdIDASBlXOIREq57i3
	 +2S8RfYkE1OU5ZY3+3V3u7CPtC/OLmGn6qrBoCtOgq22XkW3XPS2f8KE8UvOfNu14AdN/
	 m3JEQXA97rNsTodB00fJcpZCuSfwE8ZZrkuJ2ovWtg6XDmE3rj88qHmIoP0k5MRb3MpuN
	 YJcPhPSlqi/PFsPWDDZiZtOYo+Vmq0+BMdRQXlgXlAWUo46bJ+INfq8sB+gKhze8hPA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=IxpdG9A8;
	dmarc=pass header.from=linux.alibaba.com;
	spf=pass smtp.mailfrom=linux.alibaba.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 9B5F4606A32C;
	Tue, 24 Nov 2026 04:25:37 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=IxpdG9A8
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=115.124.30.101
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795494331;
	b=ec88FkM+EQSqIaZs1N9TYBTBAvNCwzMzkoen2stUdFj7k1APR2dxYsP3mFDosnb7NKyB
	 FTj6VY5BK1DzaZ7DHd8dDy/D+3uh7FbeSVd7LmqJTSXJrheWesjotA1RmZZYbHzAgrQVZ
	 cRfcX5YY1iDNBIg70zXYFGXZvaj2sO/U2WjF5KAQyLtsyqjbFgkM6f5jWNp4qusgr1SRG
	 d1VyLvojnagOrq/sNp0ck4v4bnr9+kH8GI5MwZfJEzCgFP2vVpuLZlxHi5KI5dmjiBO3K
	 A5cjYM8Ov+kNu+s0thoQz608y3QzFCDeIZGbY/2YV2WmRAyHXNuv1s+3BLYoSuBI1Ow==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795494331;
	h=DMARC-Filter:DKIM-Signature:X-Alimail-AntiSpam:Received:Date:From:To:
	 Cc:Subject:Message-ID:Reply-To:References:MIME-Version:Content-Type:
	 Content-Disposition:In-Reply-To;
	bh=OEh0PEZT89NLtHRlSYqxwc0geCRim/3SLGx9Dh1iylk=;
	b=z6SjNOr28yxDUM/dDI6N2Xo9COgXKWnSeurFxHcfD89EzTE6L1eV7c4wa29Adgb3p950
	 df10haaaMQKyA8w+NB+2InlHAR/1nHmPA/7TIYvUbI6PKpIzw1sUbxbL97P6lZ/CEZzxM
	 xZoKIDLY8z/XoxiFwIzumUFrx979+LIYkPtFHD2zOxk7NkW8noJYnOORrQsB3d2U3ouls
	 sWHsDrA3uHvfZa/CnQNLO6M9mMFGXaNdwbdPAAOPS8SL4kkm/wLcoAv37LjwJkxb+wWez
	 EmfF0U9M8k+10dEiibMSRCp5frHJCGNLoKQR7470vukDBP/gSI3SHgZyxIvalOXBkRQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=linux.alibaba.com;
	spf=pass smtp.mailfrom=linux.alibaba.com;
	dkim=pass header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=IxpdG9A8;
	arc=none smtp.remote-ip=115.124.30.101
X-Received: from out30-101.freemail.mail.aliyun.com (out30-101.freemail.mail.aliyun.com [115.124.30.101])
	(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 D6E8E606A31E;
	Tue, 24 Nov 2026 04:25:29 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D6E8E606A31E
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=linux.alibaba.com; s=default;
	t=1795494325; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type;
	bh=OEh0PEZT89NLtHRlSYqxwc0geCRim/3SLGx9Dh1iylk=;
	b=IxpdG9A8qnuRA8pxSS/Vtfm1q9AYaNeaszlZznmzBzJRjcgiLvPIt8RLR961rjg5uW4FeLt175rlpqQDrcVuv1tghRiOYeqons/t172rCbmeuVYL4TUCrsacSBVlMKvwdwHDE6px9Vm1w4M0FU4wEc5xHkcWihlZ0fe3bfVrhhw=
X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R201e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037026112;MF=dust.li@linux.alibaba.com;NM=1;PH=DS;RN=14;SR=0;TI=SMTPD_---0XFNJdsr_1795494324;
X-Received: from localhost(mailfrom:dust.li@linux.alibaba.com fp:SMTPD_---0XFNJdsr_1795494324 cluster:ay36)
          by smtp.aliyun-inc.com;
          Tue, 24 Nov 2026 12:25:25 +0800
X-Cc: tonylu@linux.alibaba.com, guwen@linux.alibaba.com, davem@davemloft.net,
	edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
	horms@kernel.org, linux-rdma@vger.kernel.org,
	linux-s390@vger.kernel.org, netdev@vger.kernel.org
X-Reply-To: dust.li@linux.alibaba.com
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-In-Reply-To: <CA+OT+OPkNsk2QHczVmb6KVJ+z_1tpH9DXm8JmACc5E6x-YFwPA@mail.gmail.com>