public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: "Eelco Chaudron" <echaudro@redhat.com>
To: "Jakub Kicinski" <kuba@kernel.org>
Cc: netdev@vger.kernel.org, davem@davemloft.net, dev@openvswitch.org
Subject: Re: [PATCH net] net: openvswitch: silence suspicious RCU usage warning
Date: Mon, 02 Nov 2020 09:52:19 +0100	[thread overview]
Message-ID: <AFFC5913-5595-464B-9B1B-EB25E730C2E2@redhat.com> (raw)
In-Reply-To: <20201030142852.7d41eecc@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net>



On 30 Oct 2020, at 22:28, Jakub Kicinski wrote:

> On Thu, 29 Oct 2020 15:53:21 +0100 Eelco Chaudron wrote:
>> Silence suspicious RCU usage warning in 
>> ovs_flow_tbl_masks_cache_resize()
>> by replacing rcu_dereference() with rcu_dereference_ovsl().
>>
>> In addition, when creating a new datapath, make sure it's configured 
>> under
>> the ovs_lock.
>>
>> Fixes: 9bf24f594c6a ("net: openvswitch: make masks cache size 
>> configurable")
>> Reported-by: syzbot+9a8f8bfcc56e8578016c@syzkaller.appspotmail.com
>> Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
>> ---
>>  net/openvswitch/datapath.c   |    8 ++++----
>>  net/openvswitch/flow_table.c |    2 +-
>>  2 files changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
>> index 832f898edb6a..020f8539fede 100644
>> --- a/net/openvswitch/datapath.c
>> +++ b/net/openvswitch/datapath.c
>> @@ -1695,6 +1695,9 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, 
>> struct genl_info *info)
>>  	if (err)
>>  		goto err_destroy_ports;
>>
>> +	/* So far only local changes have been made, now need the lock. */
>> +	ovs_lock();
>
> Should we move the lock below assignments to param?
>
> Looks a little strange to protect stack variables with a global lock.

You are right, I should have moved it down after the assignment. I will 
send out a v2.

>>  	/* Set up our datapath device. */
>>  	parms.name = nla_data(a[OVS_DP_ATTR_NAME]);
>>  	parms.type = OVS_VPORT_TYPE_INTERNAL;
>> @@ -1707,9 +1710,6 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, 
>> struct genl_info *info)
>>  	if (err)
>>  		goto err_destroy_meters;
>>
>> -	/* So far only local changes have been made, now need the lock. */
>> -	ovs_lock();
>> -
>>  	vport = new_vport(&parms);
>>  	if (IS_ERR(vport)) {
>>  		err = PTR_ERR(vport);
>> @@ -1725,7 +1725,6 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, 
>> struct genl_info *info)
>>  				ovs_dp_reset_user_features(skb, info);
>>  		}
>>
>> -		ovs_unlock();
>>  		goto err_destroy_meters;
>>  	}
>>
>> @@ -1742,6 +1741,7 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, 
>> struct genl_info *info)
>>  	return 0;
>>
>>  err_destroy_meters:
>
> Let's update the name of the label.

Guess now it is, unlock and destroy meters, so what label are you 
looking for?

err_unlock_and_destroy_meters: which looks a bit long, or just 
err_unlock:

>> +	ovs_unlock();
>>  	ovs_meters_exit(dp);
>>  err_destroy_ports:
>>  	kfree(dp->ports);
>> diff --git a/net/openvswitch/flow_table.c 
>> b/net/openvswitch/flow_table.c
>> index f3486a37361a..c89c8da99f1a 100644
>> --- a/net/openvswitch/flow_table.c
>> +++ b/net/openvswitch/flow_table.c
>> @@ -390,7 +390,7 @@ static struct mask_cache 
>> *tbl_mask_cache_alloc(u32 size)
>>  }
>>  int ovs_flow_tbl_masks_cache_resize(struct flow_table *table, u32 
>> size)
>>  {
>> -	struct mask_cache *mc = rcu_dereference(table->mask_cache);
>> +	struct mask_cache *mc = rcu_dereference_ovsl(table->mask_cache);
>>  	struct mask_cache *new;
>>
>>  	if (size == mc->cache_size)
>>


  reply	other threads:[~2020-11-02  8:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-29 14:53 [PATCH net] net: openvswitch: silence suspicious RCU usage warning Eelco Chaudron
2020-10-30 21:28 ` Jakub Kicinski
2020-11-02  8:52   ` Eelco Chaudron [this message]
2020-11-02 19:51     ` Jakub Kicinski
2020-11-03  8:26       ` Eelco Chaudron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AFFC5913-5595-464B-9B1B-EB25E730C2E2@redhat.com \
    --to=echaudro@redhat.com \
    --cc=davem@davemloft.net \
    --cc=dev@openvswitch.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox