Skip to content

Commit

Permalink
net/mlx5e: Avoid doing a cleanup call if the profile doesn't have it
Browse files Browse the repository at this point in the history
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: 26e59d8 '(net/mlx5e: Implement mlx5e interface attach/detach callbacks')
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reported-by: Sabrina Dubroca <sdubroca@redhat.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
  • Loading branch information
Or Gerlitz authored and Saeed Mahameed committed Jun 15, 2017
1 parent 9cfb4f7 commit 31ac933
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/ethernet/mellanox/mlx5/core/en_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4241,7 +4241,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;
Expand Down

0 comments on commit 31ac933

Please sign in to comment.