summaryrefslogtreecommitdiff
path: root/drivers/nvme/target/passthru.c
diff options
context:
space:
mode:
authorLogan Gunthorpe <logang@deltatee.com>2020-07-29 13:10:09 -0600
committerJens Axboe <axboe@kernel.dk>2020-08-21 17:14:27 -0600
commit0ceeab96ba598c578f0e87cb25b79349cd35b8f1 (patch)
tree73f1414cedf0ba7592c5a0e19b17e551094251ff /drivers/nvme/target/passthru.c
parent382fee1a8b623e2546a3e15e80517389e0e0673e (diff)
downloadlwn-0ceeab96ba598c578f0e87cb25b79349cd35b8f1.tar.gz
lwn-0ceeab96ba598c578f0e87cb25b79349cd35b8f1.zip
nvmet-passthru: Reject commands with non-sgl flags set
Any command with a non-SGL flag set (like fuse flags) should be rejected. Fixes: c1fef73f793b ("nvmet: add passthru code to process commands") Signed-off-by: Logan Gunthorpe <logang@deltatee.com> Signed-off-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/nvme/target/passthru.c')
-rw-r--r--drivers/nvme/target/passthru.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/nvme/target/passthru.c b/drivers/nvme/target/passthru.c
index 89d91dc999a6..f69c3ac82e58 100644
--- a/drivers/nvme/target/passthru.c
+++ b/drivers/nvme/target/passthru.c
@@ -326,6 +326,10 @@ static u16 nvmet_setup_passthru_command(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) {
case nvme_cmd_resv_register:
case nvme_cmd_resv_report:
@@ -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)
{
+ /* 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
*/