net/mlx5: Fix handling of entry refcount when command is not issued to FW
authorMoshe Shemesh <moshe@nvidia.com>
Thu, 17 Nov 2022 07:07:20 +0000 (09:07 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 Dec 2022 16:41:05 +0000 (17:41 +0100)
commitef866d9ea92221da95ba48406357f4adf44e638f
tree7484c89695f130ea7823868644562d57ca8662da
parent3101318939f592c479c97c6c12ac379a9b6ca0d5
net/mlx5: Fix handling of entry refcount when command is not issued to FW

[ Upstream commit aaf2e65cac7f2e1ae729c2fbc849091df9699f96 ]

In case command interface is down, or the command is not allowed, driver
did not increment the entry refcount, but might have decrement as part
of forced completion handling.

Fix that by always increment and decrement the refcount to make it
symmetric for all flows.

Fixes: 50b2412b7e78 ("net/mlx5: Avoid possible free of command entry while timeout comp handler")
Signed-off-by: Eran Ben Elisha <eranbe@nvidia.com>
Signed-off-by: Moshe Shemesh <moshe@nvidia.com>
Reported-by: Jack Wang <jinpu.wang@ionos.com>
Tested-by: Jack Wang <jinpu.wang@ionos.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