Re: [ovs-dev] [PATCH 2/2] datapath: ovs_ct_exit to be done under ovs_lock

2020-10-22 Thread Tonghao Zhang
On Thu, Oct 22, 2020 at 12:49 AM Greg Rose  wrote:
>
> From: Tonghao Zhang 
>
> Upstream commit:
> commit 27de77cec985233bdf6546437b9761853265c505
> Author: Tonghao Zhang 
> 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+ #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/e642a905a0cbe...@google.com
> Fixes: 11efd5cb04a1 ("openvswitch: Support conntrack zone limit")
> Cc: Pravin B Shelar 
> Cc: Yi-Hung Wei 
> Reported-by: syzbot+7ef50afd3a211f879...@syzkaller.appspotmail.com
> Signed-off-by: Tonghao Zhang 
> Acked-by: Pravin B Shelar 
> Signed-off-by: David S. Miller 
>
> Cc: Tonghao Zhang 
> Fixes: cb2a5486a3a3 ("datapath: conntrack: Support conntrack zone limit")
> Signed-off-by: Greg Rose 
Acked-by: Tonghao Zhang 
Thanks Greg

> ---
>  datapath/conntrack.c | 3 ++-
>  datapath/datapath.c  | 4 +++-
>  2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/datapath/conntrack.c b/datapath/conntrack.c
> index c7a318baf..50b4d7bd6 100644
> --- a/datapath/conntrack.c
> +++ b/datapath/conntrack.c
> @@ -1984,7 +1984,8 @@ static void ovs_ct_limit_exit(struct net *net, struct 
> ovs_net *ovs_net)
> struct hlist_head *head = >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);
> diff --git a/datapath/datapath.c b/datapath/datapath.c
> index 52a59f135..97ba5fb72 100644
> --- a/datapath/datapath.c
> +++ b/datapath/datapath.c
> @@ -2576,8 +2576,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, _net->dps, list_node)
> __dp_destroy(dp);
>
> --
> 2.17.1
>


-- 
Best regards, Tonghao
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH 2/2] datapath: ovs_ct_exit to be done under ovs_lock

2020-10-21 Thread 0-day Robot
Bleep bloop.  Greetings Greg Rose, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


checkpatch:
ERROR: Author Tonghao Zhang  needs to sign off.
WARNING: Unexpected sign-offs from developers who are not authors or co-authors 
or committers: Greg Rose 
Lines checked: 88, Warnings: 1, Errors: 1


Please check this out.  If you feel there has been an error, please email 
acon...@redhat.com

Thanks,
0-day Robot
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH 2/2] datapath: ovs_ct_exit to be done under ovs_lock

2020-10-21 Thread Greg Rose
From: Tonghao Zhang 

Upstream commit:
commit 27de77cec985233bdf6546437b9761853265c505
Author: Tonghao Zhang 
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+ #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/e642a905a0cbe...@google.com
Fixes: 11efd5cb04a1 ("openvswitch: Support conntrack zone limit")
Cc: Pravin B Shelar 
Cc: Yi-Hung Wei 
Reported-by: syzbot+7ef50afd3a211f879...@syzkaller.appspotmail.com
Signed-off-by: Tonghao Zhang 
Acked-by: Pravin B Shelar 
Signed-off-by: David S. Miller 

Cc: Tonghao Zhang 
Fixes: cb2a5486a3a3 ("datapath: conntrack: Support conntrack zone limit")
Signed-off-by: Greg Rose 
---
 datapath/conntrack.c | 3 ++-
 datapath/datapath.c  | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/datapath/conntrack.c b/datapath/conntrack.c
index c7a318baf..50b4d7bd6 100644
--- a/datapath/conntrack.c
+++ b/datapath/conntrack.c
@@ -1984,7 +1984,8 @@ static void ovs_ct_limit_exit(struct net *net, struct 
ovs_net *ovs_net)
struct hlist_head *head = >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);
diff --git a/datapath/datapath.c b/datapath/datapath.c
index 52a59f135..97ba5fb72 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -2576,8 +2576,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, _net->dps, list_node)
__dp_destroy(dp);
 
-- 
2.17.1

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev