linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nvme/ioctl: fix nvme_user_cmd() to check command allowed with flags
@ 2025-11-02 15:16 Tokunori Ikegami
  0 siblings, 0 replies; only message in thread
From: Tokunori Ikegami @ 2025-11-02 15:16 UTC (permalink / raw)
  To: linux-nvme; +Cc: Tokunori Ikegami

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@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



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-11-02 15:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-02 15:16 [PATCH] nvme/ioctl: fix nvme_user_cmd() to check command allowed with flags Tokunori Ikegami

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).