Blame SOURCES/0204-netdrv-net-mlx5-Fix-forced-completion-access-non-ini.patch

d8f823
From 531a5454501692236d41d7fbf7932a4b66340b2f Mon Sep 17 00:00:00 2001
d8f823
From: Alaa Hleihel <ahleihel@redhat.com>
d8f823
Date: Tue, 12 May 2020 10:55:21 -0400
d8f823
Subject: [PATCH 204/312] [netdrv] net/mlx5: Fix forced completion access non
d8f823
 initialized command entry
d8f823
d8f823
Message-id: <20200512105530.4207-116-ahleihel@redhat.com>
d8f823
Patchwork-id: 306987
d8f823
Patchwork-instance: patchwork
d8f823
O-Subject: [RHEL8.3 BZ 1789382 115/124] net/mlx5: Fix forced completion access non initialized command entry
d8f823
Bugzilla: 1789382
d8f823
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
d8f823
RH-Acked-by: Kamal Heib <kheib@redhat.com>
d8f823
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
d8f823
d8f823
Bugzilla: http://bugzilla.redhat.com/1789382
d8f823
Upstream: v5.7-rc5
d8f823
d8f823
commit f3cb3cebe26ed4c8036adbd9448b372129d3c371
d8f823
Author: Moshe Shemesh <moshe@mellanox.com>
d8f823
Date:   Sun Jul 21 08:40:13 2019 +0300
d8f823
d8f823
    net/mlx5: Fix forced completion access non initialized command entry
d8f823
d8f823
    mlx5_cmd_flush() will trigger forced completions to all valid command
d8f823
    entries. Triggered by an asynch event such as fast teardown it can
d8f823
    happen at any stage of the command, including command initialization.
d8f823
    It will trigger forced completion and that can lead to completion on an
d8f823
    uninitialized command entry.
d8f823
d8f823
    Setting MLX5_CMD_ENT_STATE_PENDING_COMP only after command entry is
d8f823
    initialized will ensure force completion is treated only if command
d8f823
    entry is initialized.
d8f823
d8f823
    Fixes: 73dd3a4839c1 ("net/mlx5: Avoid using pending command interface slots")
d8f823
    Signed-off-by: Moshe Shemesh <moshe@mellanox.com>
d8f823
    Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
d8f823
    Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
d8f823
d8f823
Signed-off-by: Alaa Hleihel <ahleihel@redhat.com>
d8f823
Signed-off-by: Frantisek Hrbata <fhrbata@redhat.com>
d8f823
---
d8f823
 drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 2 +-
d8f823
 1 file changed, 1 insertion(+), 1 deletion(-)
d8f823
d8f823
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
d8f823
index 71a52b890f38..59e38a6c4f52 100644
d8f823
--- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
d8f823
+++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
d8f823
@@ -888,7 +888,6 @@ static void cmd_work_handler(struct work_struct *work)
d8f823
 	}
d8f823
 
d8f823
 	cmd->ent_arr[ent->idx] = ent;
d8f823
-	set_bit(MLX5_CMD_ENT_STATE_PENDING_COMP, &ent->state);
d8f823
 	lay = get_inst(cmd, ent->idx);
d8f823
 	ent->lay = lay;
d8f823
 	memset(lay, 0, sizeof(*lay));
d8f823
@@ -910,6 +909,7 @@ static void cmd_work_handler(struct work_struct *work)
d8f823
 
d8f823
 	if (ent->callback)
d8f823
 		schedule_delayed_work(&ent->cb_timeout_work, cb_timeout);
d8f823
+	set_bit(MLX5_CMD_ENT_STATE_PENDING_COMP, &ent->state);
d8f823
 
d8f823
 	/* Skip sending command to fw if internal error */
d8f823
 	if (pci_channel_offline(dev->pdev) ||
d8f823
-- 
d8f823
2.13.6
d8f823