Skip to content

Commit 9ddb77c

Browse files
shayshyiBrian Maly
authored andcommitted
net/mlx5: Collect command failures data only for known commands
DEVX can issue a general command, which is not used by mlx5 driver. In case such command is failed, mlx5 is trying to collect the failure data, However, mlx5 doesn't create a storage for this command, since mlx5 doesn't use it. This lead to array-index-out-of-bounds error. Fix it by checking whether the command is known before collecting the failure data. Fixes: 34f46ae ("net/mlx5: Add command failures data to debugfs") Signed-off-by: Shay Drory <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]> Orabug: 35383105 (cherry picked from commit 2a0a935) cherry-pick-repo=kernel/git/torvalds/linux.git unmodified-from-upstream: 2a0a935 Signed-off-by: Mikhael Goikhman <[email protected]> Signed-off-by: Qing Huang <[email protected]> Reviewed-by: Devesh Sharma <[email protected]> Signed-off-by: Brian Maly <[email protected]>
1 parent a123ecd commit 9ddb77c

File tree

1 file changed

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

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1922,9 +1922,10 @@ static void mlx5_cmd_err_trace(struct mlx5_core_dev *dev, u16 opcode, u16 op_mod
19221922
static void cmd_status_log(struct mlx5_core_dev *dev, u16 opcode, u8 status,
19231923
u32 syndrome, int err)
19241924
{
1925+
const char *namep = mlx5_command_str(opcode);
19251926
struct mlx5_cmd_stats *stats;
19261927

1927-
if (!err)
1928+
if (!err || !(strcmp(namep, "unknown command opcode")))
19281929
return;
19291930

19301931
stats = &dev->cmd.stats[opcode];

0 commit comments

Comments
 (0)