From: Jiri Pirko <jiri@resnulli.us>
To: Bilal Hashim <AeeSec@126.com>
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
Subject: Re: [PATCH net] net: team: wait for RCU grace period before rehashing tx ports
Date: Fri, 4 Dec 2026 18:22:21 +0100 [thread overview]
Message-ID: <axL2wi7JCUZUKBM8@FV6GYCPJ69> (raw)
In-Reply-To: <179602873965.13688.342290887566008585@126.com>
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>
prev parent reply other threads:[~2026-12-04 17:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 8:52 [PATCH net] net: team: wait for RCU grace period before rehashing tx ports Bilal Hashim
2026-12-04 17:22 ` Jiri Pirko [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=axL2wi7JCUZUKBM8@FV6GYCPJ69 \
--to=jiri@resnulli.us \
--cc=AeeSec@126.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox