Article View: linux.kernel.netdev
Article #27048Re: [PATCH net] net: team: wait for RCU grace period before rehashing tx ports
From: Jiri Pirko
Date: Fri, 04 Dec 2026 17:22
Date: Fri, 04 Dec 2026 17:22
28 lines
12179 bytes
12179 bytes
Mon, Nov 30, 2026 at 09:52:19AM +0100, AeeSec@126.com wrote:
>In __reconstruct_port_hlist(), when a TX-enabled team port is disabled
>or removed, every subsequent TX-enabled port is unlinked from
>team->tx_en_port_hlist with hlist_del_rcu(&port->tx_hlist) and
>immediately re-inserted into another hash bucket with
>hlist_add_head_rcu(&port->tx_hlist, ...) without waiting for an RCU
>grace period.
>
>Reusing port->tx_hlist immediately after hlist_del_rcu() overwrites
>its next pointer while concurrent TX softirq readers in
>team_get_port_by_tx_index_rcu() may still be traversing the previous
>bucket under rcu_read_lock(). This can cause RCU readers to jump to
>another bucket, miss active ports, or loop indefinitely in TX softirq.
>
>All callers of __reconstruct_port_hlist() run in sleepable process
>context under team->lock. Unlink all affected ports first, wait for a
>single RCU grace period with synchronize_rcu() if any ports are being
>rehashed, and then update their tx_index and re-insert them into the
>hash table.
>
>Found by manual code inspection.
>
>Fixes: 3d249d4ca7d0 ("net: introduce ethernet teaming device")
>Cc: stable@vger.kernel.org
>Signed-off-by: Bilal Hashim <AeeSec@126.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Technical Details
Message-ID:
<axL2wi7JCUZUKBM8@FV6GYCPJ69>Path:
mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!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-377513-linux-kernel-netdev=dewy.ruReferences:
<179602873965.13688.342290887566008585@126.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!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-377513-linux-kernel-netdev=dewy.ru
From: jiri@resnulli.us (Jiri Pirko)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net] net: team: wait for RCU grace period before
rehashing tx ports
Date: Fri, 4 Dec 2026 18:22:21 +0100
Organization: Usenet Network
Message-ID: <axL2wi7JCUZUKBM8@FV6GYCPJ69>
References: <179602873965.13688.342290887566008585@126.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
logging-data="2817188"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:Rtg8qD1TWK0V57Li7kdEo8LXsdU= sha256:ioW1HZm73mfY/1ZTEgkFnOSrO9f0U7AdbWv3bAn1gy8=
sha1:1HXzDBad5CbiopNOvB/Ygg/qqNY= sha256:VJns8E3P77PcnId9BpRzyFX0ZpS0Dp+oNtMhYTo4TuE=
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 28434117C7F; Fri, 4 Dec 2026 20:22:43 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.298
X-Spam-Status: No, score=-3.298 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.001,
MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=resnulli.us
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 TUahSmG20IXY;
Fri, 4 Dec 2026 20:22:40 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-377513-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=resnulli.us
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id 2D78D117C75; Fri, 4 Dec 2026 20:22:32 +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 1BC9E44E8F; Fri, 4 Dec 2026 17:22:30 +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=1796404949;
b=vJgrHq7Py1egEooxLZpGNrALj58XpqitunlFA5G7x6aCcLHpxp0Ixif+1vskOdxUdfBX
WSrfzc5WG0o1k4aUGLzw7RqQCgjR6Pyy7RyapzZJOe1dmUVYID+xyH520RKw1m8wioNE8
Xl4UybU+ubLIBzSuCn/eBPlfgsaOtJMS4bNsRSSFIZhfnKcxAja6UWIGwhsu9W24E4iws
6VnA7cXD6uJhNQGoiZ9JLaeIKiF6qxbqtOg6fxd8Gd21Acu6tT9szvvz2ky8JvAYmTxPL
ZOTKvDZUTWc+f/CweGNUNo6i9qXSbZf1cpU4IvROqjRYR7Rs3EQo9vjxeG8Usa+j+vQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796404949;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
X-Gm-Gg:X-Received:Received:Date:From:To:Cc:Subject:Message-ID:
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=ZE7iBfRmTXQCuYOyFn0L9sz9oOBX/jJd1yu6RBonIks=;
b=D2Uh3vhZVyD4pVElcMrY5uGanc1xhXKfAPehKHhcbWhoG1BwTcuqh+P1bHuA0TggvM7x
+bXYGIw5/N9VkVek4MXTfIaWovoWsTB3xNGtHeROBVusicVlI4Qu2tGqfKDV41XAwAVxC
TwKuGBozWs3Vq5Gs18p2ptxevB12w/oiugz7SCC86qMscjK6A5RfhC95vuwJTDPOZhug0
HGRj21NBq9qScbglRkxJOvUs7HEqVnljw8veI7MPPYYTf5AQlE4QkRo6eNsd/ubAlkR4x
2tyPWyEjQfDhxaxJ1H9cDRWx15Gdq3sxJ4iqXWZTvt9C25OtFg+XDDmUj45DqfWJxNw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=resnulli.us header.i=@resnulli.us header.a=rsa-sha256 header.s=google header.b="VQ/zfWWW";
dmarc=pass header.from=resnulli.us;
spf=pass smtp.mailfrom=resnulli.us;
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 C9FC3606A338;
Fri, 4 Dec 2026 17:22:29 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=resnulli.us header.i=@resnulli.us header.a=rsa-sha256 header.s=google header.b=VQ/zfWWW
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.208.182
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1796404949;
b=li3GOeB558J6Cre2umQDjX6t6fV/nYJbFYeUI/pfTHs+W1GGf3WwIVA0XJhRUofZ5Atk
IE44Gh4GbkMygl7mB3xlZCrzCBuaIERU0p/ztuAbbqLQ2L1svSNbmBX8IIgx9h3eCwqHR
Fvj7mpJCTJKe4Zy4DY/MtAU6rMqmdtcPnnssjfsQiQF0mGj3U7+lM0rr1zLbjfbXtNnPk
VGmoAFg/taeqx8ePahRtmv3oL+WYH9XpF+vpKJXeyMUXzqF8dEnEXnZcYeANNkdP3/QNE
inyDesdTtE/QOsTqLpPivjkBOfhLKN0MnvOYUQ5/u4qcjlhllGgSVoGYh55WdMyju4A==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796404949;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:In-Reply-To;
bh=ZE7iBfRmTXQCuYOyFn0L9sz9oOBX/jJd1yu6RBonIks=;
b=todZlui1QdRA/uMBC7J4sNAn0pe2wc8GTmrFcEOqvCUMIopf0OfbnwcT2T85FFrZdEII
MSi0rl49x6WFK9H4SFbns6K1EtfG5H6zE/GtCJLB6kvjWP4o0edtZfY7KYmHg/Jfue7bH
NA5ehivuMCJ+uuo8PDyHgNwRTCNT0BeWQrb3h6qrP/WkhlC9+O2+fw/DZxjQvwV0n/7OR
g1LI8OBKgShgxBnh64CGsPQT/IweAU+tyxIwXB7Nnjha+6ei70Apa5R8vRj0/vb2//gns
KqGEgMkPtLYvbLnWPVURCx0TJDm/KTpy+0m6xrdyvlEh7MeIEIBEszeujE1zrj7VeQw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=resnulli.us;
spf=pass smtp.mailfrom=resnulli.us;
dkim=pass header.d=resnulli.us header.i=@resnulli.us header.a=rsa-sha256 header.s=google header.b="VQ/zfWWW";
arc=none smtp.remote-ip=209.85.208.182
X-Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id A01A3606A32C
for <netdev@vger.kernel.org>; Fri, 4 Dec 2026 17:22:28 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A01A3606A32C
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=resnulli.us
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=resnulli.us
X-Received: by mail-lj1-f182.google.com with SMTP id 38308e7fff4ca-3acef9307c7so9795621fa.2
for <netdev@vger.kernel.org>; Fri, 04 Dec 2026 09:22:28 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=resnulli.us; s=google; t=1796404947; x=1797009747; darn=vger.kernel.org;
h=in-reply-to:content-disposition:content-type:mime-version
:references:message-id:subject:cc:to:from:date:from:to:cc:subject
:date:message-id:reply-to:content-type;
bh=ZE7iBfRmTXQCuYOyFn0L9sz9oOBX/jJd1yu6RBonIks=;
b=VQ/zfWWWY0W1Lsh8PLQUSgvZom9o8Utz5GqkFAZP8vKMNumWx3RvJulK+rXoKjOapJ
6o/Nvk+P1P8fPYzlUjcFXn0vWhl3VoR93Y5Mt7kQbStZQg4tct7LfFpS/KPyao8hJmwh
Y3d4TiSaewsiiXnBtExEFsWhv5uq0RNh8+RgyorK8k0g517oNV0LLlIIyi1LFfAgfjj0
LcyPfVtOBJyxtgY1I+q4mPFcSiAhtFvOD85Ylex0+gPHxDThfuTfWCsQ/m9+t/jLuFsk
js+h9CiVpOlq+obIvOQVohDKw9p4/8PUouVlrakRgnvFphOPK2VCATbuMJIgb8Adar5k
8zJw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1796404947; x=1797009747;
h=in-reply-to:content-disposition:content-type:mime-version
:references:message-id:subject:cc:to:from:date:x-gm-gg
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
:content-type;
bh=ZE7iBfRmTXQCuYOyFn0L9sz9oOBX/jJd1yu6RBonIks=;
b=NgWGLcWwOIvPNbDjPi+rJozYbR5JMEnCRR4stG7UyYeh7wlSlqzwZiyi8CK3vlVR4G
O+hJBOGs0Y6EMKB7cYnsbuNvgqkbVOsuaV8IWxM1BF7BPTXfp+70V3eH5++gWZxikO4g
HgeHl2HFjYgdnPeN6xmAcltXT7Oldf+5bGksTGyH8bydX/Trn4rmk9s+qujJiLaLNXiD
EbkHIVq6+44kD6yJGa11OCIjmAqUQz1PHXKd2l6CbTJH/i0H6JR2MzVYIvNrWp5bJtyg
kogazk+9CGtW0iGU5fkSWSbZOt8EraIb3ooPX9skzgHf5E8k9rcXHwmVq7hyLv8/i0Ry
Iqkg==
X-Forwarded-Encrypted: i=1; AL+hErGD1jhVkIT8+i3R63RG41WM8pPVBPhjoUfFKLxTgP+Eqzolhjt30scNZg4c6BF1/8kU67BrgC8=@vger.kernel.org
X-Gm-Message-State: APuU4Z84w40awLzNBgnRe96GL7SmfXJXIkSiX2PQdfl0AFA7m6wt2rPq
C+EQPJzG3HdAkavz0MfICMBbJQ2hvn2vpJlDFg9yKl+bRNHUXiqTr/ouqsrKIFB8tps=
X-Gm-Gg: AZFdTZdVmzmTed0HUn2/qRfZpcIVKLFJmuwRzei46DpTicSKJN0e3yFhSUSg+fB3UtZ
KXfXXiIr8NQtTPRuFzy1cyFjhURuRH4HrK6ZB1Y/h/XvtSsAAQhVYGviQM/ANj/tSv4L9/FncMD
gfkiZwmO4RvU4E7WC0E5wFJmMuZPgak9cT+JTLSashVpGHZaDu49iUAOLTY2MxEOdrSORnufvr/
f55x8Ojr38OOxWiUOFQQ8dCq6vJe9Nj+nUOXFY1FTSff+sA1tObqzUxTbtsj0HPGdqoHcAl0svq
id/Or+qTK+Cr5LEXJRMXjdLf7RTtncAi4FKSNXJmeRx9ko4lIx5bVJ49QY8o/PxKR4DKnrO1unB
dlsREF/led2gZ5SiV6VqDRklXrdsEpK43kqmyz9TpMI0B9JSILzscHWckS92dBKhk2SfZZsoqNl
Fpo8rL+Q6VI3apf5/+uw+OyZOz9bsyWB+mTT/Rq/MbxPMjC+Ats3JTBL+2CAUTXPm0rjwas8igg
+EeXhENwqspsoSUfUJeRauGFL0a7tH8PLv9RKqLVLCarEJEf5mUG334RTYhf1sXWKfCC/pL0h8S
UiXW35TBm/nFSXPAQApfVVq80MgVRO+1o38ihPo=
X-Received: by 2002:a05:651c:41d4:b0:3ae:25c8:dc9a with SMTP id 38308e7fff4ca-3b0043d1c04mr7081171fa.5.1796404946846;
Fri, 04 Dec 2026 09:22:26 -0800 (PST)
X-Received: from localhost ([140.209.217.212])
by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-3b0037deb97sm9665451fa.35.2026.12.04.09.22.24
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 04 Dec 2026 09:22:25 -0800 (PST)
X-Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
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: <179602873965.13688.342290887566008585@126.com>