Commit c7d1260a authored by Or Gerlitz's avatar Or Gerlitz Committed by Greg Kroah-Hartman

net/mlx5e: Avoid doing a cleanup call if the profile doesn't have it


[ Upstream commit 31ac9338 ]

The error flow of mlx5e_create_netdev calls the cleanup call
of the given profile without checking if it exists, fix that.

Currently the VF reps don't register that callback and we crash
if getting into error -- can be reproduced by the user doing ctrl^C
while attempting to change the sriov mode from legacy to switchdev.

Fixes: 26e59d80 '(net/mlx5e: Implement mlx5e interface attach/detach callbacks')
Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
Reported-by: default avatarSabrina Dubroca <sdubroca@redhat.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 050efbe1
......@@ -3885,7 +3885,8 @@ struct net_device *mlx5e_create_netdev(struct mlx5_core_dev *mdev,
return netdev;
err_cleanup_nic:
profile->cleanup(priv);
if (profile->cleanup)
profile->cleanup(priv);
free_netdev(netdev);
return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment