[PATCH] nvme/ioctl: fix nvme_user_cmd() to check command allowed with flags
Tokunori Ikegami
ikegami.t at gmail.com
Sun Nov 2 07:16:08 PST 2025
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.
Signed-off-by: Tokunori Ikegami <ikegami.t at gmail.com>
---
drivers/nvme/host/ioctl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/host/ioctl.c b/drivers/nvme/host/ioctl.c
index c212fa952c0f..b335345d08a3 100644
--- a/drivers/nvme/host/ioctl.c
+++ b/drivers/nvme/host/ioctl.c
@@ -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))
--
2.51.0
More information about the Linux-nvme
mailing list