Skip to content

Commit fb35c53

Browse files
mariap19Saeed Mahameed
authored andcommitted
net/mlx5e: Fix NULL pointer derefernce in set channels error flow
New channels are applied to the priv channels only after they are successfully opened. Then, the indirection table should be built according to the new number of channels. Currently, such build is preformed independently of whether the channels opening is successful, and is not reverted on failure. The bug is caused due to removal of rss params from channels struct and moving it to priv struct. That change cause to independency between channels and rss params. This causes a crash on a later point, when accessing rqn of a non existing channel. This patch fixes it by moving the indirection table build right before switching the priv channels to new channels struct, after the new set of channels was successfully opened. Fixes: bbeb53b ("net/mlx5e: Move RSS params to a dedicated struct") Signed-off-by: Maria Pasechnik <mariap@mellanox.com> Reviewed-by: Tariq Toukan <tariqt@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
1 parent 2fdeee2 commit fb35c53

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,6 @@ int mlx5e_ethtool_set_channels(struct mlx5e_priv *priv,
354354

355355
new_channels.params = priv->channels.params;
356356
new_channels.params.num_channels = count;
357-
if (!netif_is_rxfh_configured(priv->netdev))
358-
mlx5e_build_default_indir_rqt(priv->rss_params.indirection_rqt,
359-
MLX5E_INDIR_RQT_SIZE, count);
360357

361358
if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) {
362359
priv->channels.params = new_channels.params;
@@ -372,6 +369,10 @@ int mlx5e_ethtool_set_channels(struct mlx5e_priv *priv,
372369
if (arfs_enabled)
373370
mlx5e_arfs_disable(priv);
374371

372+
if (!netif_is_rxfh_configured(priv->netdev))
373+
mlx5e_build_default_indir_rqt(priv->rss_params.indirection_rqt,
374+
MLX5E_INDIR_RQT_SIZE, count);
375+
375376
/* Switch to new channels, set new parameters and close old ones */
376377
mlx5e_switch_priv_channels(priv, &new_channels, NULL);
377378

0 commit comments

Comments
 (0)