Skip to contentSkip to conversation

nvme/ioctl: fix nvme_user_cmd() to check command allowed with flags

PATCH New Tokunori Ikegami 1 participant 1 message Nov 2, 2025 NVMe

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme/ioctl: fix nvme_user_cmd() to check command allowed with flags

Since only checked the flags by nvme_user_cmd64() but both functions called by nvme_ioctl setting NVME_IOCTL_PARTITION via nvme_ns_ioctl(). Also fix to pass the flags into nvme_submit_user_cmd() as same.

---
 drivers/nvme/host/ioctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/nvme/host/ioctl.c +2 -2
index c212fa952c0f..b335345d08a3 100644
@@ -308,7 +308,7 @@ static int nvme_user_cmd(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
 	c.common.cdw14 = cpu_to_le32(cmd.cdw14);
 	c.common.cdw15 = cpu_to_le32(cmd.cdw15);
 
-	if (!nvme_cmd_allowed(ns, &c, 0, open_for_write))
+	if (!nvme_cmd_allowed(ns, &c, flags, open_for_write))
 		return -EACCES;
 
 	if (cmd.timeout_ms)
@@ -316,7 +316,7 @@ static int nvme_user_cmd(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
 
 	status = nvme_submit_user_cmd(ns ? ns->queue : ctrl->admin_q, &c,
 			cmd.addr, cmd.data_len, nvme_to_user_ptr(cmd.metadata),
-			cmd.metadata_len, &result, timeout, 0);
+			cmd.metadata_len, &result, timeout, flags);
 
 	if (status >= 0) {
 		if (put_user(result, &ucmd->result))
Signature · 1 line
2.51.0