]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
net/mlx5e: Fix error path of device attach
authorAya Levin <ayal@mellanox.com>
Wed, 1 Jul 2020 09:21:53 +0000 (12:21 +0300)
committerThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Fri, 4 Sep 2020 19:28:34 +0000 (16:28 -0300)
BugLink: https://bugs.launchpad.net/bugs/1891063
[ Upstream commit 5cd39b6e9a420329a9a408894be7ba8aa7dd755e ]

On failure to attach the netdev, fix the rollback by re-setting the
device's state back to MLX5E_STATE_DESTROYING.

Failing to attach doesn't stop statistics polling via .ndo_get_stats64.
In this case, although the device is not attached, it falsely continues
to query the firmware for counters. Setting the device's state back to
MLX5E_STATE_DESTROYING prevents the firmware counters query.

Fixes: 26e59d8077a3 ("net/mlx5e: Implement mlx5e interface attach/detach callbacks")
Signed-off-by: Aya Levin <ayal@mellanox.com>
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Ian May <ian.may@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
drivers/net/ethernet/mellanox/mlx5/core/en_main.c

index c133beb6a7a56f54372cd7f90dd49914ea937680..15db4a8746dd7a10c6f252fbda1862a76dcae29c 100644 (file)
@@ -5356,6 +5356,8 @@ err_cleanup_tx:
        profile->cleanup_tx(priv);
 
 out:
+       set_bit(MLX5E_STATE_DESTROYING, &priv->state);
+       cancel_work_sync(&priv->update_stats_work);
        return err;
 }