netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: openvswitch: silence suspicious RCU usage warning
@ 2020-08-05  7:19 xiangxia.m.yue
  2020-08-05  9:00 ` Paolo Abeni
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: xiangxia.m.yue @ 2020-08-05  7:19 UTC (permalink / raw)
  To: davem, echaudro, kuba, pabeni, pshelar, syzkaller-bugs
  Cc: dev, linux-kernel, netdev, Tonghao Zhang

From: Tonghao Zhang <xiangxia.m.yue@gmail.com>

ovs_flow_tbl_destroy always is called from RCU callback
or error path. It is no need to check if rcu_read_lock
or lockdep_ovsl_is_held was held.

ovs_dp_cmd_fill_info always is called with ovs_mutex,
So use the rcu_dereference_ovsl instead of rcu_dereference
in ovs_flow_tbl_masks_cache_size.

Fixes: 9bf24f594c6a ("net: openvswitch: make masks cache size configurable")
Cc: Eelco Chaudron <echaudro@redhat.com>
Reported-by: syzbot+c0eb9e7cdde04e4eb4be@syzkaller.appspotmail.com
Reported-by: syzbot+f612c02823acb02ff9bc@syzkaller.appspotmail.com
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
---
 net/openvswitch/flow_table.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/openvswitch/flow_table.c b/net/openvswitch/flow_table.c
index 6527d84c3ea6..8c12675cbb67 100644
--- a/net/openvswitch/flow_table.c
+++ b/net/openvswitch/flow_table.c
@@ -518,8 +518,8 @@ void ovs_flow_tbl_destroy(struct flow_table *table)
 {
 	struct table_instance *ti = rcu_dereference_raw(table->ti);
 	struct table_instance *ufid_ti = rcu_dereference_raw(table->ufid_ti);
-	struct mask_cache *mc = rcu_dereference(table->mask_cache);
-	struct mask_array *ma = rcu_dereference_ovsl(table->mask_array);
+	struct mask_cache *mc = rcu_dereference_raw(table->mask_cache);
+	struct mask_array *ma = rcu_dereference_raw(table->mask_array);
 
 	call_rcu(&mc->rcu, mask_cache_rcu_cb);
 	call_rcu(&ma->rcu, mask_array_rcu_cb);
@@ -937,7 +937,7 @@ int ovs_flow_tbl_num_masks(const struct flow_table *table)
 
 u32 ovs_flow_tbl_masks_cache_size(const struct flow_table *table)
 {
-	struct mask_cache *mc = rcu_dereference(table->mask_cache);
+	struct mask_cache *mc = rcu_dereference_ovsl(table->mask_cache);
 
 	return READ_ONCE(mc->cache_size);
 }
-- 
2.26.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: openvswitch: silence suspicious RCU usage warning
  2020-08-05  7:19 [PATCH] net: openvswitch: silence suspicious RCU usage warning xiangxia.m.yue
@ 2020-08-05  9:00 ` Paolo Abeni
  2020-08-05 19:13 ` David Miller
  2020-08-05 19:21 ` Eelco Chaudron
  2 siblings, 0 replies; 4+ messages in thread
From: Paolo Abeni @ 2020-08-05  9:00 UTC (permalink / raw)
  To: xiangxia.m.yue, davem, echaudro, kuba, pshelar, syzkaller-bugs
  Cc: dev, linux-kernel, netdev

On Wed, 2020-08-05 at 15:19 +0800, xiangxia.m.yue@gmail.com wrote:
> From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> 
> ovs_flow_tbl_destroy always is called from RCU callback
> or error path. It is no need to check if rcu_read_lock
> or lockdep_ovsl_is_held was held.
> 
> ovs_dp_cmd_fill_info always is called with ovs_mutex,
> So use the rcu_dereference_ovsl instead of rcu_dereference
> in ovs_flow_tbl_masks_cache_size.
> 
> Fixes: 9bf24f594c6a ("net: openvswitch: make masks cache size configurable")
> Cc: Eelco Chaudron <echaudro@redhat.com>
> Reported-by: syzbot+c0eb9e7cdde04e4eb4be@syzkaller.appspotmail.com
> Reported-by: syzbot+f612c02823acb02ff9bc@syzkaller.appspotmail.com
> Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>

Acked-by: Paolo Abeni <pabeni@redhat.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: openvswitch: silence suspicious RCU usage warning
  2020-08-05  7:19 [PATCH] net: openvswitch: silence suspicious RCU usage warning xiangxia.m.yue
  2020-08-05  9:00 ` Paolo Abeni
@ 2020-08-05 19:13 ` David Miller
  2020-08-05 19:21 ` Eelco Chaudron
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2020-08-05 19:13 UTC (permalink / raw)
  To: xiangxia.m.yue
  Cc: echaudro, kuba, pabeni, pshelar, syzkaller-bugs, dev,
	linux-kernel, netdev

From: xiangxia.m.yue@gmail.com
Date: Wed,  5 Aug 2020 15:19:11 +0800

> From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> 
> ovs_flow_tbl_destroy always is called from RCU callback
> or error path. It is no need to check if rcu_read_lock
> or lockdep_ovsl_is_held was held.
> 
> ovs_dp_cmd_fill_info always is called with ovs_mutex,
> So use the rcu_dereference_ovsl instead of rcu_dereference
> in ovs_flow_tbl_masks_cache_size.
> 
> Fixes: 9bf24f594c6a ("net: openvswitch: make masks cache size configurable")
> Cc: Eelco Chaudron <echaudro@redhat.com>
> Reported-by: syzbot+c0eb9e7cdde04e4eb4be@syzkaller.appspotmail.com
> Reported-by: syzbot+f612c02823acb02ff9bc@syzkaller.appspotmail.com
> Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>

Applied, thank you.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: openvswitch: silence suspicious RCU usage warning
  2020-08-05  7:19 [PATCH] net: openvswitch: silence suspicious RCU usage warning xiangxia.m.yue
  2020-08-05  9:00 ` Paolo Abeni
  2020-08-05 19:13 ` David Miller
@ 2020-08-05 19:21 ` Eelco Chaudron
  2 siblings, 0 replies; 4+ messages in thread
From: Eelco Chaudron @ 2020-08-05 19:21 UTC (permalink / raw)
  To: xiangxia.m.yue
  Cc: davem, kuba, pabeni, pshelar, syzkaller-bugs, dev, linux-kernel, netdev



On 5 Aug 2020, at 9:19, xiangxia.m.yue@gmail.com wrote:

> From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
>
> ovs_flow_tbl_destroy always is called from RCU callback
> or error path. It is no need to check if rcu_read_lock
> or lockdep_ovsl_is_held was held.
>
> ovs_dp_cmd_fill_info always is called with ovs_mutex,
> So use the rcu_dereference_ovsl instead of rcu_dereference
> in ovs_flow_tbl_masks_cache_size.
>
> Fixes: 9bf24f594c6a ("net: openvswitch: make masks cache size 
> configurable")
> Cc: Eelco Chaudron <echaudro@redhat.com>
> Reported-by: syzbot+c0eb9e7cdde04e4eb4be@syzkaller.appspotmail.com
> Reported-by: syzbot+f612c02823acb02ff9bc@syzkaller.appspotmail.com
> Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>

Thanks for fixing this, I was (am) on PTO so did not notice it earlier!

Cheers,

Eelco


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-08-05 19:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-05  7:19 [PATCH] net: openvswitch: silence suspicious RCU usage warning xiangxia.m.yue
2020-08-05  9:00 ` Paolo Abeni
2020-08-05 19:13 ` David Miller
2020-08-05 19:21 ` Eelco Chaudron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).