ovs_ct_copy_action() keeps the timeout policy of the action's conntrack template only so that skb_nfct_cached() can compare it with the policy of a later connection; the pointer is never dereferenced through this copy. It is read with rcu_dereference() outside an RCU read-side critical section, so adding a ct action with a timeout policy makes lockdep complain: WARNING: suspicious RCU usage net/openvswitch/conntrack.c:1435 suspicious rcu_dereference_check() usage! Call Trace: ovs_ct_copy_action (net/openvswitch/conntrack.c:1435) __ovs_nla_copy_actions (net/openvswitch/flow_netlink.c:3478) ovs_nla_copy_actions (net/openvswitch/flow_netlink.c:3617) ovs_flow_cmd_new (net/openvswitch/datapath.c:1058) genl_family_rcv_msg_doit (net/netlink/genetlink.c:1114) Read it with rcu_access_pointer(). Fixes: 7177895154e6 ("openvswitch: Fix conntrack cache with timeout") Signed-off-by: Kyuwon Cho <kyuw…@skku.edu> --- The issue was found by an LLM-guided test generator that we are developing as a research prototype. It reproduces with CONFIG_PROVE_RCU as any user in its own user and network namespace: a conntrack timeout policy created through nfnetlink_cttimeout, an OVS datapath, and a flow whose ct action names that policy. With the patch lockdep stays quiet. Found and tested on mainline fe6ff8d5d675 (v7.4-rc5, with KASAN); the patch is against net (76fca30e8d34). net/openvswitch/conntrack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c index d3326edcabf7..fc0779e30be2 100644 --- a/net/openvswitch/conntrack.c +++ b/net/openvswitch/conntrack.c @@ -1432,7 +1432,7 @@ int ovs_ct_copy_action(struct net *net, const struct nlattr *attr, "Failed to associated timeout policy '%s'", ct_info.timeout); else - ct_info.nf_ct_timeout = rcu_dereference( + ct_info.nf_ct_timeout = rcu_access_pointer( nf_ct_timeout_find(ct_info.ct)->timeout); }
-- 2.43.0