Eric Dumazet
d2346e6beb
net: bridge: use DEV_STATS_INC()
...
[ Upstream commit 44bdb313da
]
syzbot/KCSAN reported data-races in br_handle_frame_finish() [1]
This function can run from multiple cpus without mutual exclusion.
Adopt SMP safe DEV_STATS_INC() to update dev->stats fields.
Handles updates to dev->stats.tx_dropped while we are at it.
[1]
BUG: KCSAN: data-race in br_handle_frame_finish / br_handle_frame_finish
read-write to 0xffff8881374b2178 of 8 bytes by interrupt on cpu 1:
br_handle_frame_finish+0xd4f/0xef0 net/bridge/br_input.c:189
br_nf_hook_thresh+0x1ed/0x220
br_nf_pre_routing_finish_ipv6+0x50f/0x540
NF_HOOK include/linux/netfilter.h:304 [inline]
br_nf_pre_routing_ipv6+0x1e3/0x2a0 net/bridge/br_netfilter_ipv6.c:178
br_nf_pre_routing+0x526/0xba0 net/bridge/br_netfilter_hooks.c:508
nf_hook_entry_hookfn include/linux/netfilter.h:144 [inline]
nf_hook_bridge_pre net/bridge/br_input.c:272 [inline]
br_handle_frame+0x4c9/0x940 net/bridge/br_input.c:417
__netif_receive_skb_core+0xa8a/0x21e0 net/core/dev.c:5417
__netif_receive_skb_one_core net/core/dev.c:5521 [inline]
__netif_receive_skb+0x57/0x1b0 net/core/dev.c:5637
process_backlog+0x21f/0x380 net/core/dev.c:5965
__napi_poll+0x60/0x3b0 net/core/dev.c:6527
napi_poll net/core/dev.c:6594 [inline]
net_rx_action+0x32b/0x750 net/core/dev.c:6727
__do_softirq+0xc1/0x265 kernel/softirq.c:553
run_ksoftirqd+0x17/0x20 kernel/softirq.c:921
smpboot_thread_fn+0x30a/0x4a0 kernel/smpboot.c:164
kthread+0x1d7/0x210 kernel/kthread.c:388
ret_from_fork+0x48/0x60 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304
read-write to 0xffff8881374b2178 of 8 bytes by interrupt on cpu 0:
br_handle_frame_finish+0xd4f/0xef0 net/bridge/br_input.c:189
br_nf_hook_thresh+0x1ed/0x220
br_nf_pre_routing_finish_ipv6+0x50f/0x540
NF_HOOK include/linux/netfilter.h:304 [inline]
br_nf_pre_routing_ipv6+0x1e3/0x2a0 net/bridge/br_netfilter_ipv6.c:178
br_nf_pre_routing+0x526/0xba0 net/bridge/br_netfilter_hooks.c:508
nf_hook_entry_hookfn include/linux/netfilter.h:144 [inline]
nf_hook_bridge_pre net/bridge/br_input.c:272 [inline]
br_handle_frame+0x4c9/0x940 net/bridge/br_input.c:417
__netif_receive_skb_core+0xa8a/0x21e0 net/core/dev.c:5417
__netif_receive_skb_one_core net/core/dev.c:5521 [inline]
__netif_receive_skb+0x57/0x1b0 net/core/dev.c:5637
process_backlog+0x21f/0x380 net/core/dev.c:5965
__napi_poll+0x60/0x3b0 net/core/dev.c:6527
napi_poll net/core/dev.c:6594 [inline]
net_rx_action+0x32b/0x750 net/core/dev.c:6727
__do_softirq+0xc1/0x265 kernel/softirq.c:553
do_softirq+0x5e/0x90 kernel/softirq.c:454
__local_bh_enable_ip+0x64/0x70 kernel/softirq.c:381
__raw_spin_unlock_bh include/linux/spinlock_api_smp.h:167 [inline]
_raw_spin_unlock_bh+0x36/0x40 kernel/locking/spinlock.c:210
spin_unlock_bh include/linux/spinlock.h:396 [inline]
batadv_tt_local_purge+0x1a8/0x1f0 net/batman-adv/translation-table.c:1356
batadv_tt_purge+0x2b/0x630 net/batman-adv/translation-table.c:3560
process_one_work kernel/workqueue.c:2630 [inline]
process_scheduled_works+0x5b8/0xa30 kernel/workqueue.c:2703
worker_thread+0x525/0x730 kernel/workqueue.c:2784
kthread+0x1d7/0x210 kernel/kthread.c:388
ret_from_fork+0x48/0x60 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304
value changed: 0x00000000000d7190 -> 0x00000000000d7191
Reported by Kernel Concurrency Sanitizer on:
CPU: 0 PID: 14848 Comm: kworker/u4:11 Not tainted 6.6.0-rc1-syzkaller-00236-gad8a69f361b9 #0
Fixes: 1c29fc4989
("[BRIDGE]: keep track of received multicast packets")
Reported-by: syzbot <syzkaller@googlegroups.com >
Signed-off-by: Eric Dumazet <edumazet@google.com >
Cc: Roopa Prabhu <roopa@nvidia.com >
Cc: Nikolay Aleksandrov <razor@blackwall.org >
Cc: bridge@lists.linux-foundation.org
Acked-by: Nikolay Aleksandrov <razor@blackwall.org >
Link: https://lore.kernel.org/r/20230918091351.1356153-1-edumazet@google.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2023-10-10 21:44:57 +02:00
..
2020-01-27 14:50:41 +01:00
2023-09-23 10:47:57 +02:00
2023-01-18 11:30:36 +01:00
2023-05-30 12:42:11 +01:00
2021-04-07 12:48:49 +02:00
2023-06-09 10:24:01 +02:00
2022-04-27 13:39:46 +02:00
2023-08-30 16:31:55 +02:00
2023-08-30 16:31:43 +02:00
2022-11-25 17:40:29 +01:00
2020-01-27 14:50:51 +01:00
2023-10-10 21:44:57 +02:00
2023-03-17 08:31:44 +01:00
2023-08-11 11:45:24 +02:00
2023-08-11 11:45:38 +02:00
2023-10-10 21:44:57 +02:00
2022-03-08 19:04:10 +01:00
2023-09-23 10:48:11 +02:00
2023-06-21 15:39:57 +02:00
2020-04-23 10:30:24 +02:00
2022-03-23 09:10:44 +01:00
2020-01-09 10:19:09 +01:00
2022-12-08 11:18:33 +01:00
2022-11-03 23:52:30 +09:00
2023-10-10 21:44:56 +02:00
2023-09-23 10:48:13 +02:00
2023-03-22 13:27:10 +01:00
2023-09-23 10:48:15 +02:00
2023-08-30 16:31:48 +02:00
2023-04-26 11:21:53 +02:00
2021-02-10 09:21:06 +01:00
2023-08-11 11:45:26 +02:00
2023-04-20 12:04:38 +02:00
2022-12-14 11:28:28 +01:00
2023-02-22 12:47:21 +01:00
2021-04-14 08:22:35 +02:00
2023-10-10 21:44:56 +02:00
2023-09-23 10:47:58 +02:00
2023-08-11 11:45:07 +02:00
2023-09-23 10:48:01 +02:00
2023-08-11 11:45:04 +02:00
2023-05-30 12:42:11 +01:00
2023-02-22 12:47:12 +01:00
2023-08-16 18:13:00 +02:00
2022-01-11 13:58:50 +01:00
2019-12-05 09:21:30 +01:00
2021-09-03 09:58:00 +02:00
2023-03-11 16:31:37 +01:00
2020-01-12 12:17:17 +01:00
2023-02-22 12:47:19 +01:00
2023-05-17 11:13:24 +02:00
2023-09-23 10:48:18 +02:00
2023-09-23 10:47:58 +02:00
2022-09-15 12:17:03 +02:00
2023-08-11 11:45:20 +02:00
2023-06-21 15:39:59 +02:00
2022-07-29 17:10:32 +02:00
2023-09-23 10:48:13 +02:00
2023-05-30 12:42:10 +01:00
2023-08-11 11:45:25 +02:00
2023-02-22 12:47:12 +01:00
2021-05-22 10:59:48 +02:00
2023-08-30 16:31:50 +02:00
2021-06-30 08:48:13 -04:00
2023-06-21 15:39:57 +02:00
2023-06-21 15:39:57 +02:00
2023-09-23 10:47:58 +02:00