lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 11 Sep 2023 02:26:41 +0500
From:   Ameer Hamza <ahamza@...ystems.com>
To:     linux-nvme@...ts.infradead.org
Cc:     kbusch@...nel.org, axboe@...nel.dk, hch@....de, sagi@...mberg.me,
        linux-kernel@...r.kernel.org, mav@...ystems.com,
        edmund.nadolski@...ystems.com, ahamza@...ystems.com
Subject: [PATCH] nvme: prevent id ctrl csi for specs below 2.0

The 'id ctrl csi' command was introduced in version 2.0, as specified
in Section 5.17.2.6 of the NVME Base Specification 2.0. Executing this
command on previous NVMe versions returns an "Invalid Field" error,
and the error entry is saved in the log page. Although, Commit
c917dd96fe41 ("nvme: skip optional id ctrl csi if it failed") reduced
the error occurrences, but the error persisted during the initial
module load. This patch ensures the command isn't executed on versions
older than 2.0, and it also eliminates the skip implementation because
NVME_ID_CNS_CS_CTRL is expected to succeed with version 2.0.

Signed-off-by: Ameer Hamza <ahamza@...ystems.com>
---
 drivers/nvme/host/core.c | 6 ++----
 drivers/nvme/host/nvme.h | 3 +--
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index f3a01b79148c..6c92aa5704f9 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2894,9 +2894,9 @@ static int nvme_init_non_mdts_limits(struct nvme_ctrl *ctrl)
 	else
 		ctrl->max_zeroes_sectors = 0;
 
+	/* NVME_ID_CNS_CS_CTRL is supported from v2.0 onwards. */
 	if (ctrl->subsys->subtype != NVME_NQN_NVME ||
-	    nvme_ctrl_limited_cns(ctrl) ||
-	    test_bit(NVME_CTRL_SKIP_ID_CNS_CS, &ctrl->flags))
+	    ctrl->vs < NVME_VS(2, 0, 0))
 		return 0;
 
 	id = kzalloc(sizeof(*id), GFP_KERNEL);
@@ -2918,8 +2918,6 @@ static int nvme_init_non_mdts_limits(struct nvme_ctrl *ctrl)
 		ctrl->max_zeroes_sectors = nvme_mps_to_sectors(ctrl, id->wzsl);
 
 free_data:
-	if (ret > 0)
-		set_bit(NVME_CTRL_SKIP_ID_CNS_CS, &ctrl->flags);
 	kfree(id);
 	return ret;
 }
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index f35647c470af..f3cf10710bce 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -249,8 +249,7 @@ enum nvme_ctrl_flags {
 	NVME_CTRL_ADMIN_Q_STOPPED	= 1,
 	NVME_CTRL_STARTED_ONCE		= 2,
 	NVME_CTRL_STOPPED		= 3,
-	NVME_CTRL_SKIP_ID_CNS_CS	= 4,
-	NVME_CTRL_DIRTY_CAPABILITY	= 5,
+	NVME_CTRL_DIRTY_CAPABILITY	= 4,
 };
 
 struct nvme_ctrl {
-- 
2.39.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ