Skip to content

Commit

Permalink
datapath: ovs_ct_exit to be done under ovs_lock
Browse files Browse the repository at this point in the history
Upstream commit:
    commit 27de77cec985233bdf6546437b9761853265c505
    Author: Tonghao Zhang <[email protected]>
    Date:   Fri Apr 17 02:57:31 2020 +0800

    net: openvswitch: ovs_ct_exit to be done under ovs_lock

    syzbot wrote:
    | =============================
    | WARNING: suspicious RCU usage
    | 5.7.0-rc1+ openvswitch#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: 11efd5cb04a1 ("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]>

Cc: Tonghao Zhang <[email protected]>
Fixes: cb2a548 ("datapath: conntrack: Support conntrack zone limit")
Signed-off-by: Greg Rose <[email protected]>
Acked-by: Tonghao Zhang <[email protected]>
Signed-off-by: Ilya Maximets <[email protected]>
  • Loading branch information
xpu22 authored and igsilya committed Nov 27, 2020
1 parent 8236704 commit fa57e9e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion datapath/conntrack.c
Original file line number Diff line number Diff line change
Expand Up @@ -1984,7 +1984,8 @@ static void ovs_ct_limit_exit(struct net *net, struct ovs_net *ovs_net)
struct hlist_head *head = &info->limits[i];
struct ovs_ct_limit *ct_limit;

hlist_for_each_entry_rcu(ct_limit, head, hlist_node)
hlist_for_each_entry_rcu(ct_limit, head, hlist_node,
lockdep_ovsl_is_held())
kfree_rcu(ct_limit, rcu);
}
kfree(ovs_net->ct_limit_info->limits);
Expand Down
4 changes: 3 additions & 1 deletion datapath/datapath.c
Original file line number Diff line number Diff line change
Expand Up @@ -2572,8 +2572,10 @@ static void __net_exit ovs_exit_net(struct net *dnet)

ovs_netns_frags6_exit(dnet);
ovs_netns_frags_exit(dnet);
ovs_ct_exit(dnet);
ovs_lock();

ovs_ct_exit(dnet);

list_for_each_entry_safe(dp, dp_next, &ovs_net->dps, list_node)
__dp_destroy(dp);

Expand Down

0 comments on commit fa57e9e

Please sign in to comment.