Skip to content

Commit 4acc0b1

Browse files
hao022gregkh
authored andcommitted
net: openvswitch: ovs_ct_exit to be done under ovs_lock
[ Upstream commit 27de77c ] syzbot wrote: | ============================= | WARNING: suspicious RCU usage | 5.7.0-rc1+ hardkernel#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]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 21b1a76 commit 4acc0b1

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

net/openvswitch/conntrack.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -1890,7 +1890,8 @@ static void ovs_ct_limit_exit(struct net *net, struct ovs_net *ovs_net)
18901890
struct hlist_head *head = &info->limits[i];
18911891
struct ovs_ct_limit *ct_limit;
18921892

1893-
hlist_for_each_entry_rcu(ct_limit, head, hlist_node)
1893+
hlist_for_each_entry_rcu(ct_limit, head, hlist_node,
1894+
lockdep_ovsl_is_held())
18941895
kfree_rcu(ct_limit, rcu);
18951896
}
18961897
kfree(ovs_net->ct_limit_info->limits);

net/openvswitch/datapath.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -2430,8 +2430,10 @@ static void __net_exit ovs_exit_net(struct net *dnet)
24302430
struct net *net;
24312431
LIST_HEAD(head);
24322432

2433-
ovs_ct_exit(dnet);
24342433
ovs_lock();
2434+
2435+
ovs_ct_exit(dnet);
2436+
24352437
list_for_each_entry_safe(dp, dp_next, &ovs_net->dps, list_node)
24362438
__dp_destroy(dp);
24372439

0 commit comments

Comments
 (0)