Skip to content

Commit 27de77c

Browse files
hao022davem330
authored andcommitted
net: openvswitch: ovs_ct_exit to be done under ovs_lock
syzbot wrote: | ============================= | WARNING: suspicious RCU usage | 5.7.0-rc1+ #45 Not tainted | ----------------------------- | net/openvswitch/conntrack.c:1898 RCU-list traversed in non-reader section!! | | other info that might help us debug this: | rcu_scheduler_active = 2, debug_locks = 1 | ... | | stack backtrace: | Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.0-0-ga698c8995f-prebuilt.qemu.org 04/01/2014 | Workqueue: netns cleanup_net | Call Trace: | ... | ovs_ct_exit | ovs_exit_net | ops_exit_list.isra.7 | cleanup_net | process_one_work | worker_thread To avoid that warning, invoke the ovs_ct_exit under ovs_lock and add lockdep_ovsl_is_held as optional lockdep expression. Link: https://lore.kernel.org/lkml/[email protected] Fixes: 11efd5c ("openvswitch: Support conntrack zone limit") Cc: Pravin B Shelar <[email protected]> Cc: Yi-Hung Wei <[email protected]> Reported-by: [email protected] Signed-off-by: Tonghao Zhang <[email protected]> Acked-by: Pravin B Shelar <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9bacd25 commit 27de77c

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

net/openvswitch/conntrack.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1895,7 +1895,8 @@ static void ovs_ct_limit_exit(struct net *net, struct ovs_net *ovs_net)
18951895
struct hlist_head *head = &info->limits[i];
18961896
struct ovs_ct_limit *ct_limit;
18971897

1898-
hlist_for_each_entry_rcu(ct_limit, head, hlist_node)
1898+
hlist_for_each_entry_rcu(ct_limit, head, hlist_node,
1899+
lockdep_ovsl_is_held())
18991900
kfree_rcu(ct_limit, rcu);
19001901
}
19011902
kfree(ovs_net->ct_limit_info->limits);

net/openvswitch/datapath.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2466,8 +2466,10 @@ static void __net_exit ovs_exit_net(struct net *dnet)
24662466
struct net *net;
24672467
LIST_HEAD(head);
24682468

2469-
ovs_ct_exit(dnet);
24702469
ovs_lock();
2470+
2471+
ovs_ct_exit(dnet);
2472+
24712473
list_for_each_entry_safe(dp, dp_next, &ovs_net->dps, list_node)
24722474
__dp_destroy(dp);
24732475

0 commit comments

Comments
 (0)