Skip to content

Commit a198574

Browse files
Achiad Shochatdavem330
authored andcommitted
net/mlx5e: Avoid NULL pointer access in case of configuration failure
In case a configuration operation that involves closing and re-opening resources (e.g RX/TX queue size change) fails at the re-opening stage these resources will remain closed. So when executing (following) configuration operations (e.g ifconfig down) we cannot assume that these resources are available. Signed-off-by: Achiad Shochat <[email protected]> Signed-off-by: Or Gerlitz <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent fd867d5 commit a198574

File tree

1 file changed

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

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,6 +1404,12 @@ int mlx5e_close_locked(struct net_device *netdev)
14041404
{
14051405
struct mlx5e_priv *priv = netdev_priv(netdev);
14061406

1407+
/* May already be CLOSED in case a previous configuration operation
1408+
* (e.g RX/TX queue size change) that involves close&open failed.
1409+
*/
1410+
if (!test_bit(MLX5E_STATE_OPENED, &priv->state))
1411+
return 0;
1412+
14071413
clear_bit(MLX5E_STATE_OPENED, &priv->state);
14081414

14091415
mlx5e_redirect_rqts(priv);

0 commit comments

Comments
 (0)