bridge.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 nf] bridge: br_vlan_fill_forward_path_pvid: use br_vlan_group_rcu()
@ 2025-10-07  8:15 Eric Woudstra
  2025-10-07 10:00 ` Pablo Neira Ayuso
  2025-10-07 10:09 ` Florian Westphal
  0 siblings, 2 replies; 5+ messages in thread
From: Eric Woudstra @ 2025-10-07  8:15 UTC (permalink / raw)
  To: Nikolay Aleksandrov, Ido Schimmel, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Simon Horman, Felix Fietkau,
	Pablo Neira Ayuso
  Cc: bridge, netdev, netfilter-devel, Eric Woudstra

Bug: br_vlan_fill_forward_path_pvid uses br_vlan_group() instead of
br_vlan_group_rcu(). Correct this bug.

Fixes: bcf2766b1377 ("net: bridge: resolve forwarding path for VLAN tag actions in bridge devices")
Signed-off-by: Eric Woudstra <ericwouds@gmail.com>

---

Also see the debugging info send by Florian in mailing:
"[RFC PATCH v3 nf-next] selftests: netfilter: Add bridge_fastpath.sh"

net/bridge/br_private.h:1627 suspicious rcu_dereference_protected() usage!

other info that might help us debug this:

rcu_scheduler_active = 2, debug_locks = 1
7 locks held by socat/410:
 #0: ffff88800d7a9c90 (sk_lock-AF_INET){+.+.}-{0:0}, at: inet_stream_connect+0x43/0xa0
 #1: ffffffff9a779900 (rcu_read_lock){....}-{1:3}, at: __ip_queue_xmit+0x62/0x1830
 #2: ffffffff9a779900 (rcu_read_lock){....}-{1:3}, at: ip_output+0x57/0x3c0
 #3: ffffffff9a779900 (rcu_read_lock){....}-{1:3}, at: ip_finish_output2+0x263/0x17d0
 #4: ffffffff9a779900 (rcu_read_lock){....}-{1:3}, at: process_backlog+0x38a/0x14b0
 #5: ffffffff9a779900 (rcu_read_lock){....}-{1:3}, at: netif_receive_skb_internal+0x83/0x330
 #6: ffffffff9a779900 (rcu_read_lock){....}-{1:3}, at: nf_hook.constprop.0+0x8a/0x440

stack backtrace:
CPU: 0 UID: 0 PID: 410 Comm: socat Not tainted 6.17.0-rc7-virtme #1 PREEMPT(full)
Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
Call Trace:
 <IRQ>
 dump_stack_lvl+0x6f/0xb0
 lockdep_rcu_suspicious.cold+0x4f/0xb1
 br_vlan_fill_forward_path_pvid+0x32c/0x410 [bridge]
 br_fill_forward_path+0x7a/0x4d0 [bridge]
 ...

 net/bridge/br_vlan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
index 939a3aa78d5c..54993a05037c 100644
--- a/net/bridge/br_vlan.c
+++ b/net/bridge/br_vlan.c
@@ -1455,7 +1455,7 @@ void br_vlan_fill_forward_path_pvid(struct net_bridge *br,
 	if (!br_opt_get(br, BROPT_VLAN_ENABLED))
 		return;
 
-	vg = br_vlan_group(br);
+	vg = br_vlan_group_rcu(br);
 
 	if (idx >= 0 &&
 	    ctx->vlan[idx].proto == br->vlan_proto) {
-- 
2.50.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 nf] bridge: br_vlan_fill_forward_path_pvid: use br_vlan_group_rcu()
  2025-10-07  8:15 [PATCH v1 nf] bridge: br_vlan_fill_forward_path_pvid: use br_vlan_group_rcu() Eric Woudstra
@ 2025-10-07 10:00 ` Pablo Neira Ayuso
  2025-10-07 10:09 ` Florian Westphal
  1 sibling, 0 replies; 5+ messages in thread
From: Pablo Neira Ayuso @ 2025-10-07 10:00 UTC (permalink / raw)
  To: Eric Woudstra
  Cc: Nikolay Aleksandrov, Ido Schimmel, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Simon Horman, Felix Fietkau, bridge,
	netdev, netfilter-devel

On Tue, Oct 07, 2025 at 10:15:01AM +0200, Eric Woudstra wrote:
> Bug: br_vlan_fill_forward_path_pvid uses br_vlan_group() instead of
> br_vlan_group_rcu(). Correct this bug.
> 
> Fixes: bcf2766b1377 ("net: bridge: resolve forwarding path for VLAN tag actions in bridge devices")
> Signed-off-by: Eric Woudstra <ericwouds@gmail.com>

Patch looks good.

dev_fill_forward_path() is assumed to run under RCU.

> ---
> 
> Also see the debugging info send by Florian in mailing:
> "[RFC PATCH v3 nf-next] selftests: netfilter: Add bridge_fastpath.sh"
> 
> net/bridge/br_private.h:1627 suspicious rcu_dereference_protected() usage!
> 
> other info that might help us debug this:
> 
> rcu_scheduler_active = 2, debug_locks = 1
> 7 locks held by socat/410:
>  #0: ffff88800d7a9c90 (sk_lock-AF_INET){+.+.}-{0:0}, at: inet_stream_connect+0x43/0xa0
>  #1: ffffffff9a779900 (rcu_read_lock){....}-{1:3}, at: __ip_queue_xmit+0x62/0x1830
>  #2: ffffffff9a779900 (rcu_read_lock){....}-{1:3}, at: ip_output+0x57/0x3c0
>  #3: ffffffff9a779900 (rcu_read_lock){....}-{1:3}, at: ip_finish_output2+0x263/0x17d0
>  #4: ffffffff9a779900 (rcu_read_lock){....}-{1:3}, at: process_backlog+0x38a/0x14b0
>  #5: ffffffff9a779900 (rcu_read_lock){....}-{1:3}, at: netif_receive_skb_internal+0x83/0x330
>  #6: ffffffff9a779900 (rcu_read_lock){....}-{1:3}, at: nf_hook.constprop.0+0x8a/0x440
> 
> stack backtrace:
> CPU: 0 UID: 0 PID: 410 Comm: socat Not tainted 6.17.0-rc7-virtme #1 PREEMPT(full)
> Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
> Call Trace:
>  <IRQ>
>  dump_stack_lvl+0x6f/0xb0
>  lockdep_rcu_suspicious.cold+0x4f/0xb1
>  br_vlan_fill_forward_path_pvid+0x32c/0x410 [bridge]
>  br_fill_forward_path+0x7a/0x4d0 [bridge]
>  ...
> 
>  net/bridge/br_vlan.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
> index 939a3aa78d5c..54993a05037c 100644
> --- a/net/bridge/br_vlan.c
> +++ b/net/bridge/br_vlan.c
> @@ -1455,7 +1455,7 @@ void br_vlan_fill_forward_path_pvid(struct net_bridge *br,
>  	if (!br_opt_get(br, BROPT_VLAN_ENABLED))
>  		return;
>  
> -	vg = br_vlan_group(br);
> +	vg = br_vlan_group_rcu(br);
>  
>  	if (idx >= 0 &&
>  	    ctx->vlan[idx].proto == br->vlan_proto) {
> -- 
> 2.50.0
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 nf] bridge: br_vlan_fill_forward_path_pvid: use br_vlan_group_rcu()
  2025-10-07  8:15 [PATCH v1 nf] bridge: br_vlan_fill_forward_path_pvid: use br_vlan_group_rcu() Eric Woudstra
  2025-10-07 10:00 ` Pablo Neira Ayuso
@ 2025-10-07 10:09 ` Florian Westphal
  2025-10-07 11:07   ` Pablo Neira Ayuso
  1 sibling, 1 reply; 5+ messages in thread
From: Florian Westphal @ 2025-10-07 10:09 UTC (permalink / raw)
  To: Eric Woudstra
  Cc: Nikolay Aleksandrov, Ido Schimmel, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Simon Horman, Felix Fietkau,
	Pablo Neira Ayuso, bridge, netdev, netfilter-devel

Eric Woudstra <ericwouds@gmail.com> wrote:
> Bug: br_vlan_fill_forward_path_pvid uses br_vlan_group() instead of
> br_vlan_group_rcu(). Correct this bug.

@netdev maintainers:

In case you wish to take this via net tree:

Reviewed-by: Florian Westphal <fw@strlen.de>

Else I will apply this to nf.git and will pass it to -net
in next PR.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 nf] bridge: br_vlan_fill_forward_path_pvid: use br_vlan_group_rcu()
  2025-10-07 10:09 ` Florian Westphal
@ 2025-10-07 11:07   ` Pablo Neira Ayuso
  2025-10-07 12:49     ` Paolo Abeni
  0 siblings, 1 reply; 5+ messages in thread
From: Pablo Neira Ayuso @ 2025-10-07 11:07 UTC (permalink / raw)
  To: Florian Westphal
  Cc: Eric Woudstra, Nikolay Aleksandrov, Ido Schimmel, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman,
	Felix Fietkau, bridge, netdev, netfilter-devel

On Tue, Oct 07, 2025 at 12:09:51PM +0200, Florian Westphal wrote:
> Eric Woudstra <ericwouds@gmail.com> wrote:
> > Bug: br_vlan_fill_forward_path_pvid uses br_vlan_group() instead of
> > br_vlan_group_rcu(). Correct this bug.
> 
> @netdev maintainers:
> 
> In case you wish to take this via net tree:
> 
> Reviewed-by: Florian Westphal <fw@strlen.de>
> 
> Else I will apply this to nf.git and will pass it to -net
> in next PR.

There are more fixes cooking, probably we can prepare a batch.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 nf] bridge: br_vlan_fill_forward_path_pvid: use br_vlan_group_rcu()
  2025-10-07 11:07   ` Pablo Neira Ayuso
@ 2025-10-07 12:49     ` Paolo Abeni
  0 siblings, 0 replies; 5+ messages in thread
From: Paolo Abeni @ 2025-10-07 12:49 UTC (permalink / raw)
  To: Pablo Neira Ayuso, Florian Westphal
  Cc: Eric Woudstra, Nikolay Aleksandrov, Ido Schimmel, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Simon Horman, Felix Fietkau, bridge,
	netdev, netfilter-devel

On 10/7/25 1:07 PM, Pablo Neira Ayuso wrote:
> On Tue, Oct 07, 2025 at 12:09:51PM +0200, Florian Westphal wrote:
>> Eric Woudstra <ericwouds@gmail.com> wrote:
>>> Bug: br_vlan_fill_forward_path_pvid uses br_vlan_group() instead of
>>> br_vlan_group_rcu(). Correct this bug.
>>
>> @netdev maintainers:
>>
>> In case you wish to take this via net tree:
>>
>> Reviewed-by: Florian Westphal <fw@strlen.de>
>>
>> Else I will apply this to nf.git and will pass it to -net
>> in next PR.
> 
> There are more fixes cooking, probably we can prepare a batch.

FWIW, I think it makes sense to wait for a NF PR.

Thanks,

Paolo


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-10-07 12:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-07  8:15 [PATCH v1 nf] bridge: br_vlan_fill_forward_path_pvid: use br_vlan_group_rcu() Eric Woudstra
2025-10-07 10:00 ` Pablo Neira Ayuso
2025-10-07 10:09 ` Florian Westphal
2025-10-07 11:07   ` Pablo Neira Ayuso
2025-10-07 12:49     ` Paolo Abeni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).