Baowen Zheng
963178a063
flow_offload: fix suspicious RCU usage when offloading tc action
Fix suspicious rcu_dereference_protected() usage when offloading tc action.
We should hold tcfa_lock to offload tc action in action initiation.
Without these changes, the following warning will be observed:
WARNING: suspicious RCU usage
5.16.0-rc5-net-next-01504-g7d1f236dcffa-dirty #50 Tainted: G I
-----------------------------
include/net/tc_act/tc_tunnel_key.h:33 suspicious rcu_dereference_protected() usage!
1 lock held by tc/12108:
CPU: 4 PID: 12108 Comm: tc Tainted: G
Hardware name: Dell Inc. PowerEdge R740/07WCGN, BIOS 1.6.11 11/20/2018
Call Trace:
<TASK>
dump_stack_lvl+0x49/0x5e
dump_stack+0x10/0x12
lockdep_rcu_suspicious+0xed/0xf8
tcf_tunnel_key_offload_act_setup+0x1de/0x300 [act_tunnel_key]
tcf_action_offload_add_ex+0xc0/0x1f0
tcf_action_init+0x26a/0x2f0
tcf_action_add+0xa9/0x1f0
tc_ctl_action+0xfb/0x170
rtnetlink_rcv_msg+0x169/0x510
? sched_clock+0x9/0x10
? rtnl_newlink+0x70/0x70
netlink_rcv_skb+0x55/0x100
rtnetlink_rcv+0x15/0x20
netlink_unicast+0x1a8/0x270
netlink_sendmsg+0x245/0x490
sock_sendmsg+0x65/0x70
____sys_sendmsg+0x219/0x260
? __import_iovec+0x2c/0x150
___sys_sendmsg+0xb7/0x100
? __lock_acquire+0x3d5/0x1f40
? __this_cpu_preempt_check+0x13/0x20
? lock_is_held_type+0xe4/0x140
? sched_clock+0x9/0x10
? ktime_get_coarse_real_ts64+0xbe/0xd0
? __this_cpu_preempt_check+0x13/0x20
? lockdep_hardirqs_on+0x7e/0x100
? ktime_get_coarse_real_ts64+0xbe/0xd0
? trace_hardirqs_on+0x2a/0xf0
__sys_sendmsg+0x5a/0xa0
? syscall_trace_enter.constprop.0+0x1dd/0x220
__x64_sys_sendmsg+0x1f/0x30
do_syscall_64+0x3b/0x90
entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7f4db7bb7a60
Fixes: 8cbfe939ab ("flow_offload: allow user to offload tc action to net device")
Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Baowen Zheng <baowen.zheng@corigine.com>
Signed-off-by: Louis Peens <louis.peens@corigine.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-12-23 11:17:00 +00:00
..
2021-07-22 16:19:03 +02:00
2021-11-04 21:04:25 +09:00
2021-11-19 11:23:23 +00:00
2021-12-07 20:44:58 -08:00
2021-07-23 14:20:25 +01:00
2021-10-24 13:59:45 +01:00
2021-12-07 20:44:59 -08:00
2021-11-10 16:15:54 -08:00
2021-11-17 14:52:44 +00:00
2021-11-01 14:10:00 -07:00
2021-06-25 13:13:50 +02:00
2021-12-15 17:29:28 -08:00
2021-10-24 13:59:45 +01:00
2021-11-06 17:29:32 +01:00
2021-11-08 03:29:52 +01:00
2021-12-21 19:08:54 -08:00
2021-11-23 20:16:22 -08:00
2021-12-16 07:18:35 -08:00
2021-12-14 12:45:16 +00:00
2021-11-24 17:21:42 -08:00
2021-12-15 15:09:24 +00:00
2021-11-29 12:12:36 +00:00
2021-11-16 13:20:45 +00:00
2021-12-16 16:13:19 -08:00
2021-12-16 16:13:19 -08:00
2021-11-19 11:52:25 +00:00
2021-06-29 11:28:21 -07:00
2021-12-10 06:38:27 -08:00
2021-06-08 16:31:25 -07:00
2021-12-10 19:43:00 -08:00
2021-12-21 07:41:52 -08:00
2021-10-20 14:27:40 +01:00
2021-12-20 18:40:48 -08:00
2021-12-02 11:44:56 -08:00
2021-12-17 19:27:05 -08:00
2021-11-24 11:53:17 +00:00
2021-12-15 17:29:28 -08:00
2021-08-30 12:23:18 +01:00
2021-12-02 11:44:56 -08:00
2021-10-13 09:40:45 -07:00
2021-12-09 07:50:32 -08:00
2021-12-07 20:45:00 -08:00
2021-12-16 16:13:19 -08:00
2021-12-10 19:53:52 -08:00
2021-09-28 17:36:43 -07:00
2021-12-16 16:13:19 -08:00
2021-12-20 11:02:38 +01:00
2021-10-13 09:40:45 -07:00
2021-11-29 15:40:02 +00:00
2021-12-23 11:17:00 +00:00
2021-12-23 11:15:30 +00:00
2021-12-16 16:13:19 -08:00
2021-11-09 01:05:28 +01:00
2021-11-27 10:33:55 -08:00
2021-12-07 20:44:58 -08:00
2021-12-15 15:07:04 +00:00
2021-12-02 11:44:56 -08:00
2021-12-13 12:47:47 +00:00
2021-12-16 16:13:19 -08:00
2021-12-21 07:41:52 -08:00
2021-12-09 18:35:11 -08:00
2021-12-16 16:13:19 -08:00
2021-12-10 08:16:33 -08:00
2021-06-03 15:13:56 -07:00
2021-06-11 12:55:28 -07:00
2021-11-20 12:25:57 +00:00
2021-12-10 06:38:26 -08:00
2021-07-29 15:06:49 +01:00
2021-08-31 16:43:06 -07:00
2021-11-09 10:02:50 -08:00