Message ID | 1640147146-4294-1-git-send-email-baowen.zheng@corigine.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 963178a06352a059c688eb36f1f8c2f03212b60b |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net-next,v1] flow_offload: fix suspicious RCU usage when offloading tc action | expand |
Hello: This patch was applied to netdev/net-next.git (master) by David S. Miller <davem@davemloft.net>: On Wed, 22 Dec 2021 12:25:46 +0800 you wrote: > 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 > > [...] Here is the summary with links: - [net-next,v1] flow_offload: fix suspicious RCU usage when offloading tc action https://git.kernel.org/netdev/net-next/c/963178a06352 You are awesome, thank you!
diff --git a/net/sched/act_api.c b/net/sched/act_api.c index b2f8a39..32563ce 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c @@ -186,12 +186,19 @@ static int offload_action_init(struct flow_offload_action *fl_action, enum offload_act_command cmd, struct netlink_ext_ack *extack) { + int err; + fl_action->extack = extack; fl_action->command = cmd; fl_action->index = act->tcfa_index; - if (act->ops->offload_act_setup) - return act->ops->offload_act_setup(act, fl_action, NULL, false); + if (act->ops->offload_act_setup) { + spin_lock_bh(&act->tcfa_lock); + err = act->ops->offload_act_setup(act, fl_action, NULL, + false); + spin_unlock_bh(&act->tcfa_lock); + return err; + } return -EOPNOTSUPP; }