linux-yocto/net/bridge
Wang Liang a74abcf0f0 netfilter: br_netfilter: do not check confirmed bit in br_nf_local_in() after confirm
[ Upstream commit 479a54ab92087318514c82428a87af2d7af1a576 ]

When send a broadcast packet to a tap device, which was added to a bridge,
br_nf_local_in() is called to confirm the conntrack. If another conntrack
with the same hash value is added to the hash table, which can be
triggered by a normal packet to a non-bridge device, the below warning
may happen.

  ------------[ cut here ]------------
  WARNING: CPU: 1 PID: 96 at net/bridge/br_netfilter_hooks.c:632 br_nf_local_in+0x168/0x200
  CPU: 1 UID: 0 PID: 96 Comm: tap_send Not tainted 6.17.0-rc2-dirty #44 PREEMPT(voluntary)
  RIP: 0010:br_nf_local_in+0x168/0x200
  Call Trace:
   <TASK>
   nf_hook_slow+0x3e/0xf0
   br_pass_frame_up+0x103/0x180
   br_handle_frame_finish+0x2de/0x5b0
   br_nf_hook_thresh+0xc0/0x120
   br_nf_pre_routing_finish+0x168/0x3a0
   br_nf_pre_routing+0x237/0x5e0
   br_handle_frame+0x1ec/0x3c0
   __netif_receive_skb_core+0x225/0x1210
   __netif_receive_skb_one_core+0x37/0xa0
   netif_receive_skb+0x36/0x160
   tun_get_user+0xa54/0x10c0
   tun_chr_write_iter+0x65/0xb0
   vfs_write+0x305/0x410
   ksys_write+0x60/0xd0
   do_syscall_64+0xa4/0x260
   entry_SYSCALL_64_after_hwframe+0x77/0x7f
   </TASK>
  ---[ end trace 0000000000000000 ]---

To solve the hash conflict, nf_ct_resolve_clash() try to merge the
conntracks, and update skb->_nfct. However, br_nf_local_in() still use the
old ct from local variable 'nfct' after confirm(), which leads to this
warning.

If confirm() does not insert the conntrack entry and return NF_DROP, the
warning may also occur. There is no need to reserve the WARN_ON_ONCE, just
remove it.

Link: https://lore.kernel.org/netdev/20250820043329.2902014-1-wangliang74@huawei.com/
Fixes: 62e7151ae3 ("netfilter: bridge: confirm multicast packets before passing them up the stack")
Suggested-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Wang Liang <wangliang74@huawei.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-09-09 19:02:20 +02:00
..
netfilter netfilter: bridge: Move specific fragmented packet to slow_path instead of dropping it 2025-05-05 13:13:08 +02:00
br_arp_nd_proxy.c net: bridge: Prevent unicast ARP/NS packets from being suppressed by bridge 2025-04-09 19:13:43 -07:00
br_cfm_netlink.c
br_cfm.c
br_device.c net: move misc netdev_lock flavors to a separate header 2025-03-08 09:06:50 -08:00
br_fdb.c rtnetlink: add ndo_fdb_dump_context 2024-12-10 18:32:32 -08:00
br_forward.c net: bridge: add skb drop reasons to the most common drop points 2024-12-23 10:11:04 -08:00
br_if.c
br_input.c net: bridge: locally receive all multicast packets if IFF_ALLMULTI is set 2025-04-15 17:25:52 -07:00
br_ioctl.c net: Remove RTNL dance for SIOCBRADDIF and SIOCBRDELIF. 2025-03-21 22:10:06 +01:00
br_mdb.c net: bridge: mcast: Notify on mdb offload failure 2025-04-14 15:56:43 -07:00
br_mrp_netlink.c
br_mrp_switchdev.c
br_mrp.c
br_mst.c net: bridge: mcast: update multicast contex when vlan state is changed 2025-04-23 13:02:20 +01:00
br_multicast_eht.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
br_multicast.c net: bridge: fix soft lockup in br_multicast_query_expired() 2025-08-28 16:34:44 +02:00
br_netfilter_hooks.c netfilter: br_netfilter: do not check confirmed bit in br_nf_local_in() after confirm 2025-09-09 19:02:20 +02:00
br_netfilter_ipv6.c
br_netlink_tunnel.c net: bridge: fix an inconsistent indentation 2024-06-05 10:04:47 +01:00
br_netlink.c rtnetlink: Pack newlink() params into struct 2025-02-21 15:28:02 -08:00
br_nf_core.c bridge: netfilter: Fix forwarding of fragmented packets 2025-05-16 16:02:06 -07:00
br_private_cfm.h
br_private_mcast_eht.h
br_private_mrp.h
br_private_stp.h
br_private_tunnel.h
br_private.h net: bridge: fix soft lockup in br_multicast_query_expired() 2025-08-28 16:34:44 +02:00
br_stp_bpdu.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
br_stp_if.c treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
br_stp_timer.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
br_stp.c treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
br_switchdev.c net: bridge: Do not offload IGMP/MLD messages 2025-07-17 07:46:41 -07:00
br_sysfs_br.c net: bridge: constify 'struct bin_attribute' 2024-12-17 19:00:43 -08:00
br_sysfs_if.c
br_vlan_options.c
br_vlan_tunnel.c ip_tunnel: convert __be16 tunnel flags to bitmaps 2024-04-01 10:49:28 +01:00
br_vlan.c net: bridge: switchdev: do not notify new brentries as changed 2025-04-16 18:11:39 -07:00
br.c bridge: Convert br_net_exit_batch_rtnl() to ->exit_rtnl(). 2025-04-14 17:08:43 -07:00
Kconfig
Makefile