net/mlx5: Fix forced completion access non initialized command entry
authorMoshe Shemesh <moshe@mellanox.com>
Sun, 21 Jul 2019 05:40:13 +0000 (08:40 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 14 May 2020 05:58:23 +0000 (07:58 +0200)
commit11dd1d0ebfdd613d35c714261be22329f092a8c8
treeea66da6422dfbc41e5a481c792eadf7fdd2d86c2
parent18cfbcdf1f41d5987928a6acb5ff341ee448218f
net/mlx5: Fix forced completion access non initialized command entry

[ Upstream commit f3cb3cebe26ed4c8036adbd9448b372129d3c371 ]

mlx5_cmd_flush() will trigger forced completions to all valid command
entries. Triggered by an asynch event such as fast teardown it can
happen at any stage of the command, including command initialization.
It will trigger forced completion and that can lead to completion on an
uninitialized command entry.

Setting MLX5_CMD_ENT_STATE_PENDING_COMP only after command entry is
initialized will ensure force completion is treated only if command
entry is initialized.

Fixes: 73dd3a4839c1 ("net/mlx5: Avoid using pending command interface slots")
Signed-off-by: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/mellanox/mlx5/core/cmd.c