diff options
author | Achiad Shochat <achiad@mellanox.com> | 2015-11-03 07:07:18 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-11-03 16:41:50 +0100 |
commit | a1985740904342a884471348f6e038ee5d706c36 (patch) | |
tree | 2b2cc81fbc375eacb4d2dea9637b03f50dddf3f5 | |
parent | net/core: generic support for disabling netdev features down stack (diff) | |
download | linux-a1985740904342a884471348f6e038ee5d706c36.tar.xz linux-a1985740904342a884471348f6e038ee5d706c36.zip |
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 <achiad@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index bb801a9bbd42..9df6f9ae9bb5 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -1404,6 +1404,12 @@ int mlx5e_close_locked(struct net_device *netdev) { struct mlx5e_priv *priv = netdev_priv(netdev); + /* May already be CLOSED in case a previous configuration operation + * (e.g RX/TX queue size change) that involves close&open failed. + */ + if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) + return 0; + clear_bit(MLX5E_STATE_OPENED, &priv->state); mlx5e_redirect_rqts(priv); |