Skip to content

Commit

Permalink
net: openvswitch: silence suspicious RCU usage warning
Browse files Browse the repository at this point in the history
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: 9bf24f5 ("net: openvswitch: make masks cache size configurable")
Reported-by: [email protected]
Signed-off-by: Eelco Chaudron <[email protected]>
Link: https://lore.kernel.org/r/160439190002.56943.1418882726496275961.stgit@ebuild
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
chaudron authored and kuba-moo committed Nov 4, 2020
1 parent dbfe394 commit fea07a4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions net/openvswitch/datapath.c
Original file line number Diff line number Diff line change
Expand Up @@ -1703,13 +1703,13 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info)
parms.port_no = OVSP_LOCAL;
parms.upcall_portids = a[OVS_DP_ATTR_UPCALL_PID];

err = ovs_dp_change(dp, a);
if (err)
goto err_destroy_meters;

/* So far only local changes have been made, now need the lock. */
ovs_lock();

err = ovs_dp_change(dp, a);
if (err)
goto err_unlock_and_destroy_meters;

vport = new_vport(&parms);
if (IS_ERR(vport)) {
err = PTR_ERR(vport);
Expand All @@ -1725,8 +1725,7 @@ 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;
goto err_unlock_and_destroy_meters;
}

err = ovs_dp_cmd_fill_info(dp, reply, info->snd_portid,
Expand All @@ -1741,7 +1740,8 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info)
ovs_notify(&dp_datapath_genl_family, reply, info);
return 0;

err_destroy_meters:
err_unlock_and_destroy_meters:
ovs_unlock();
ovs_meters_exit(dp);
err_destroy_ports:
kfree(dp->ports);
Expand Down
2 changes: 1 addition & 1 deletion net/openvswitch/flow_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit fea07a4

Please sign in to comment.