Commit 0ceeab96 authored by Logan Gunthorpe's avatar Logan Gunthorpe Committed by Jens Axboe

nvmet-passthru: Reject commands with non-sgl flags set

Any command with a non-SGL flag set (like fuse flags) should be
rejected.

Fixes: c1fef73f ("nvmet: add passthru code to process commands")
Signed-off-by: default avatarLogan Gunthorpe <logang@deltatee.com>
Signed-off-by: default avatarSagi Grimberg <sagi@grimberg.me>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 382fee1a
...@@ -326,6 +326,10 @@ static u16 nvmet_setup_passthru_command(struct nvmet_req *req) ...@@ -326,6 +326,10 @@ static u16 nvmet_setup_passthru_command(struct nvmet_req *req)
u16 nvmet_parse_passthru_io_cmd(struct nvmet_req *req) u16 nvmet_parse_passthru_io_cmd(struct nvmet_req *req)
{ {
/* Reject any commands with non-sgl flags set (ie. fused commands) */
if (req->cmd->common.flags & ~NVME_CMD_SGL_ALL)
return NVME_SC_INVALID_FIELD;
switch (req->cmd->common.opcode) { switch (req->cmd->common.opcode) {
case nvme_cmd_resv_register: case nvme_cmd_resv_register:
case nvme_cmd_resv_report: case nvme_cmd_resv_report:
...@@ -396,6 +400,10 @@ static u16 nvmet_passthru_get_set_features(struct nvmet_req *req) ...@@ -396,6 +400,10 @@ static u16 nvmet_passthru_get_set_features(struct nvmet_req *req)
u16 nvmet_parse_passthru_admin_cmd(struct nvmet_req *req) u16 nvmet_parse_passthru_admin_cmd(struct nvmet_req *req)
{ {
/* Reject any commands with non-sgl flags set (ie. fused commands) */
if (req->cmd->common.flags & ~NVME_CMD_SGL_ALL)
return NVME_SC_INVALID_FIELD;
/* /*
* Passthru all vendor specific commands * Passthru all vendor specific commands
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment