Skip to content

Commit fea07a4

Browse files
chaudronkuba-moo
authored andcommitted
net: openvswitch: silence suspicious RCU usage warning
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: syzbot+9a8f8bfcc56e8578016c@syzkaller.appspotmail.com Signed-off-by: Eelco Chaudron <echaudro@redhat.com> Link: https://lore.kernel.org/r/160439190002.56943.1418882726496275961.stgit@ebuild Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent dbfe394 commit fea07a4

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

net/openvswitch/datapath.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1703,13 +1703,13 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info)
17031703
parms.port_no = OVSP_LOCAL;
17041704
parms.upcall_portids = a[OVS_DP_ATTR_UPCALL_PID];
17051705

1706-
err = ovs_dp_change(dp, a);
1707-
if (err)
1708-
goto err_destroy_meters;
1709-
17101706
/* So far only local changes have been made, now need the lock. */
17111707
ovs_lock();
17121708

1709+
err = ovs_dp_change(dp, a);
1710+
if (err)
1711+
goto err_unlock_and_destroy_meters;
1712+
17131713
vport = new_vport(&parms);
17141714
if (IS_ERR(vport)) {
17151715
err = PTR_ERR(vport);
@@ -1725,8 +1725,7 @@ static int ovs_dp_cmd_new(struct sk_buff *skb, struct genl_info *info)
17251725
ovs_dp_reset_user_features(skb, info);
17261726
}
17271727

1728-
ovs_unlock();
1729-
goto err_destroy_meters;
1728+
goto err_unlock_and_destroy_meters;
17301729
}
17311730

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

1744-
err_destroy_meters:
1743+
err_unlock_and_destroy_meters:
1744+
ovs_unlock();
17451745
ovs_meters_exit(dp);
17461746
err_destroy_ports:
17471747
kfree(dp->ports);

net/openvswitch/flow_table.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ static struct mask_cache *tbl_mask_cache_alloc(u32 size)
390390
}
391391
int ovs_flow_tbl_masks_cache_resize(struct flow_table *table, u32 size)
392392
{
393-
struct mask_cache *mc = rcu_dereference(table->mask_cache);
393+
struct mask_cache *mc = rcu_dereference_ovsl(table->mask_cache);
394394
struct mask_cache *new;
395395

396396
if (size == mc->cache_size)

0 commit comments

Comments
 (0)