Linux-NVME Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] nvmet-passthru: Reject commands with non-sgl flags set
@ 2020-07-29 19:10 Logan Gunthorpe
  2020-08-03  8:29 ` Sagi Grimberg
  2020-08-03 19:09 ` Chaitanya Kulkarni
  0 siblings, 2 replies; 3+ messages in thread
From: Logan Gunthorpe @ 2020-07-29 19:10 UTC (permalink / raw)
  To: linux-kernel, linux-nvme
  Cc: Sagi Grimberg, Chaitanya Kulkarni, Stephen Bates, Jens Axboe,
	Keith Busch, Max Gurtovoy, Logan Gunthorpe, Christoph Hellwig

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

Note: this patch may be squashed with the patch noted in the fixes
tag, currently in nvme-5.9.

 drivers/nvme/target/passthru.c | 8 ++++++++
 1 file changed, 8 insertions(+)

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
 	 */

base-commit: b6cec06d19d90db5dbcc50034fb33983f6259b8b
--
2.20.1

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] nvmet-passthru: Reject commands with non-sgl flags set
  2020-07-29 19:10 [PATCH] nvmet-passthru: Reject commands with non-sgl flags set Logan Gunthorpe
@ 2020-08-03  8:29 ` Sagi Grimberg
  2020-08-03 19:09 ` Chaitanya Kulkarni
  1 sibling, 0 replies; 3+ messages in thread
From: Sagi Grimberg @ 2020-08-03  8:29 UTC (permalink / raw)
  To: Logan Gunthorpe, linux-kernel, linux-nvme
  Cc: Chaitanya Kulkarni, Stephen Bates, Jens Axboe, Keith Busch,
	Max Gurtovoy, Christoph Hellwig

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] nvmet-passthru: Reject commands with non-sgl flags set
  2020-07-29 19:10 [PATCH] nvmet-passthru: Reject commands with non-sgl flags set Logan Gunthorpe
  2020-08-03  8:29 ` Sagi Grimberg
@ 2020-08-03 19:09 ` Chaitanya Kulkarni
  1 sibling, 0 replies; 3+ messages in thread
From: Chaitanya Kulkarni @ 2020-08-03 19:09 UTC (permalink / raw)
  To: Logan Gunthorpe, linux-kernel, linux-nvme
  Cc: Sagi Grimberg, Stephen Bates, Jens Axboe, Keith Busch,
	Max Gurtovoy, Christoph Hellwig

On 7/29/20 12:10, Logan Gunthorpe wrote:
> 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>

Looks good.

Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-29 19:10 [PATCH] nvmet-passthru: Reject commands with non-sgl flags set Logan Gunthorpe
2020-08-03  8:29 ` Sagi Grimberg
2020-08-03 19:09 ` Chaitanya Kulkarni

Linux-NVME Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-nvme/0 linux-nvme/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-nvme linux-nvme/ https://lore.kernel.org/linux-nvme \
		linux-nvme@lists.infradead.org
	public-inbox-index linux-nvme

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-nvme


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git