net/mlx5: Set command entry semaphore up once got index free
authorMoshe Shemesh <moshe@nvidia.com>
Sun, 5 Dec 2021 10:07:49 +0000 (12:07 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jan 2022 09:54:02 +0000 (10:54 +0100)
commite801f81cee3c8901f52ee48c6329802b28fbb49c
treec22963d178ee11d9a77e378ed4e8921a7b92e2cd
parentd2b9ce705d793c2ce942a42ee8b7483d799080e3
net/mlx5: Set command entry semaphore up once got index free

[ Upstream commit 8e715cd613a1e872b9d918e912d90b399785761a ]

Avoid a race where command work handler may fail to allocate command
entry index, by holding the command semaphore down till command entry
index is being freed.

Fixes: 410bd754cd73 ("net/mlx5: Add retry mechanism to the command entry index allocation")
Signed-off-by: Moshe Shemesh <moshe@nvidia.com>
Reviewed-by: Eran Ben Elisha <eranbe@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/cmd.c