Skip to content

Commit c1aea9e

Browse files
w1ldptrSaeed Mahameed
authored andcommitted
net/mlx5e: Fix usage of rcu-protected pointer
In mlx5e_configure_flower() flow pointer is protected by rcu read lock. However, after cited commit the pointer is being used outside of rcu read block. Extend the block to protect all pointer accesses. Fixes: 553f932 ("net/mlx5e: Support tc block sharing for representors") Signed-off-by: Vlad Buslov <[email protected]> Reviewed-by: Roi Dayan <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 2fb15e7 commit c1aea9e

File tree

1 file changed

+6
-3
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core

1 file changed

+6
-3
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_tc.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4687,22 +4687,25 @@ int mlx5e_configure_flower(struct net_device *dev, struct mlx5e_priv *priv,
46874687

46884688
rcu_read_lock();
46894689
flow = rhashtable_lookup(tc_ht, &f->cookie, tc_ht_params);
4690-
rcu_read_unlock();
46914690
if (flow) {
46924691
/* Same flow rule offloaded to non-uplink representor sharing tc block,
46934692
* just return 0.
46944693
*/
46954694
if (is_flow_rule_duplicate_allowed(dev, rpriv) && flow->orig_dev != dev)
4696-
goto out;
4695+
goto rcu_unlock;
46974696

46984697
NL_SET_ERR_MSG_MOD(extack,
46994698
"flow cookie already exists, ignoring");
47004699
netdev_warn_once(priv->netdev,
47014700
"flow cookie %lx already exists, ignoring\n",
47024701
f->cookie);
47034702
err = -EEXIST;
4704-
goto out;
4703+
goto rcu_unlock;
47054704
}
4705+
rcu_unlock:
4706+
rcu_read_unlock();
4707+
if (flow)
4708+
goto out;
47064709

47074710
trace_mlx5e_configure_flower(f);
47084711
err = mlx5e_tc_add_flow(priv, f, flags, dev, &flow);

0 commit comments

Comments
 (0)