Skip to content
/ linux Public

Commit 1758810

Browse files
shayshyiSasha Levin
authored andcommitted
net/mlx5: Fix missing devlink lock in SRIOV enable error path
[ Upstream commit 6025304 ] The cited commit miss to add locking in the error path of mlx5_sriov_enable(). When pci_enable_sriov() fails, mlx5_device_disable_sriov() is called to clean up. This cleanup function now expects to be called with the devlink instance lock held. Add the missing devl_lock(devlink) and devl_unlock(devlink) Fixes: 84a433a ("net/mlx5: Lock mlx5 devlink reload callbacks") Signed-off-by: Shay Drory <shayd@nvidia.com> Reviewed-by: Mark Bloch <mbloch@nvidia.com> Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20260224114652.1787431-5-tariqt@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 54fb057 commit 1758810

File tree

1 file changed

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

1 file changed

+2
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,9 @@ static int mlx5_sriov_enable(struct pci_dev *pdev, int num_vfs)
193193
err = pci_enable_sriov(pdev, num_vfs);
194194
if (err) {
195195
mlx5_core_warn(dev, "pci_enable_sriov failed : %d\n", err);
196+
devl_lock(devlink);
196197
mlx5_device_disable_sriov(dev, num_vfs, true, true);
198+
devl_unlock(devlink);
197199
}
198200
return err;
199201
}

0 commit comments

Comments
 (0)