nvme/ioctl: fix nvme_user_cmd() to check command allowed with flags
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.
Signed-off-by Tokunori Ikegami <[email protected]>
--- drivers/nvme/host/ioctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/nvme/host/ioctl.c +2 -2
@@ -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