All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvmet-tcp: do not continue for invalid icreq
@ 2024-01-12  7:23 hare
  2024-01-15 12:54 ` Sagi Grimberg
  2024-01-15 22:11 ` Chaitanya Kulkarni
  0 siblings, 2 replies; 7+ messages in thread
From: hare @ 2024-01-12  7:23 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Sagi Grimberg, Keith Busch, linux-nvme, Hannes Reinecke

From: Hannes Reinecke <hare@suse.de>

When the length check for an icreq sqe fails we should not
continue processing but rather return immediately as all
other contents of that sqe cannot be relied on.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/nvme/target/tcp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
index 6a1e6bb80062..3d606ab01506 100644
--- a/drivers/nvme/target/tcp.c
+++ b/drivers/nvme/target/tcp.c
@@ -898,6 +898,7 @@ static int nvmet_tcp_handle_icreq(struct nvmet_tcp_queue *queue)
 		pr_err("bad nvme-tcp pdu length (%d)\n",
 			le32_to_cpu(icreq->hdr.plen));
 		nvmet_tcp_fatal_error(queue);
+		return -EPROTO;
 	}
 
 	if (icreq->pfv != NVME_TCP_PFV_1_0) {
-- 
2.35.3



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

* Re: [PATCH] nvmet-tcp: do not continue for invalid icreq
  2024-01-12  7:23 [PATCH] nvmet-tcp: do not continue for invalid icreq hare
@ 2024-01-15 12:54 ` Sagi Grimberg
  2024-01-15 22:11 ` Chaitanya Kulkarni
  1 sibling, 0 replies; 7+ messages in thread
From: Sagi Grimberg @ 2024-01-15 12:54 UTC (permalink / raw)
  To: hare, Christoph Hellwig; +Cc: Keith Busch, linux-nvme, Hannes Reinecke

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


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

* Re: [PATCH] nvmet-tcp: do not continue for invalid icreq
  2024-01-12  7:23 [PATCH] nvmet-tcp: do not continue for invalid icreq hare
  2024-01-15 12:54 ` Sagi Grimberg
@ 2024-01-15 22:11 ` Chaitanya Kulkarni
  1 sibling, 0 replies; 7+ messages in thread
From: Chaitanya Kulkarni @ 2024-01-15 22:11 UTC (permalink / raw)
  To: hare@kernel.org, Christoph Hellwig
  Cc: Sagi Grimberg, Keith Busch, linux-nvme@lists.infradead.org,
	Hannes Reinecke

On 1/11/24 23:23, hare@kernel.org wrote:
> From: Hannes Reinecke <hare@suse.de>
>
> When the length check for an icreq sqe fails we should not
> continue processing but rather return immediately as all
> other contents of that sqe cannot be relied on.

above can be restructured at the time of applying the patch :-

When the length check for an icreq sqe fails we should not continue
processing but rather return immediately as all other contents of the
sqe cannot be relied on.

> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
>   drivers/nvme/target/tcp.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
> index 6a1e6bb80062..3d606ab01506 100644
> --- a/drivers/nvme/target/tcp.c
> +++ b/drivers/nvme/target/tcp.c
> @@ -898,6 +898,7 @@ static int nvmet_tcp_handle_icreq(struct nvmet_tcp_queue *queue)
>   		pr_err("bad nvme-tcp pdu length (%d)\n",
>   			le32_to_cpu(icreq->hdr.plen));
>   		nvmet_tcp_fatal_error(queue);
> +		return -EPROTO;
>   	}
>   
>   	if (icreq->pfv != NVME_TCP_PFV_1_0) {

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck



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

* [PATCH] nvmet-tcp: do not continue for invalid icreq
@ 2024-03-08  7:11 Hannes Reinecke
  2024-03-08  9:57 ` Sagi Grimberg
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Hannes Reinecke @ 2024-03-08  7:11 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Keith Busch, Sagi Grimberg, linux-nvme, Hannes Reinecke

From: Hannes Reinecke <hare@suse.de>

When the length check for an icreq sqe fails we should not
continue processing but rather return immediately as all
other contents of that sqe cannot be relied on.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/nvme/target/tcp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
index 6a1e6bb80062..3d606ab01506 100644
--- a/drivers/nvme/target/tcp.c
+++ b/drivers/nvme/target/tcp.c
@@ -898,6 +898,7 @@ static int nvmet_tcp_handle_icreq(struct nvmet_tcp_queue *queue)
 		pr_err("bad nvme-tcp pdu length (%d)\n",
 			le32_to_cpu(icreq->hdr.plen));
 		nvmet_tcp_fatal_error(queue);
+		return -EPROTO;
 	}
 
 	if (icreq->pfv != NVME_TCP_PFV_1_0) {
-- 
2.35.3



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

* Re: [PATCH] nvmet-tcp: do not continue for invalid icreq
  2024-03-08  7:11 Hannes Reinecke
@ 2024-03-08  9:57 ` Sagi Grimberg
  2024-03-08 14:42 ` Christoph Hellwig
  2024-03-08 16:20 ` Keith Busch
  2 siblings, 0 replies; 7+ messages in thread
From: Sagi Grimberg @ 2024-03-08  9:57 UTC (permalink / raw)
  To: Hannes Reinecke, Christoph Hellwig
  Cc: Keith Busch, linux-nvme, Hannes Reinecke

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


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

* Re: [PATCH] nvmet-tcp: do not continue for invalid icreq
  2024-03-08  7:11 Hannes Reinecke
  2024-03-08  9:57 ` Sagi Grimberg
@ 2024-03-08 14:42 ` Christoph Hellwig
  2024-03-08 16:20 ` Keith Busch
  2 siblings, 0 replies; 7+ messages in thread
From: Christoph Hellwig @ 2024-03-08 14:42 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Christoph Hellwig, Keith Busch, Sagi Grimberg, linux-nvme,
	Hannes Reinecke

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>



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

* Re: [PATCH] nvmet-tcp: do not continue for invalid icreq
  2024-03-08  7:11 Hannes Reinecke
  2024-03-08  9:57 ` Sagi Grimberg
  2024-03-08 14:42 ` Christoph Hellwig
@ 2024-03-08 16:20 ` Keith Busch
  2 siblings, 0 replies; 7+ messages in thread
From: Keith Busch @ 2024-03-08 16:20 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Christoph Hellwig, Sagi Grimberg, linux-nvme, Hannes Reinecke

Thanks, applied to nvme-6.9.


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

end of thread, other threads:[~2024-03-08 16:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-12  7:23 [PATCH] nvmet-tcp: do not continue for invalid icreq hare
2024-01-15 12:54 ` Sagi Grimberg
2024-01-15 22:11 ` Chaitanya Kulkarni
  -- strict thread matches above, loose matches on Subject: below --
2024-03-08  7:11 Hannes Reinecke
2024-03-08  9:57 ` Sagi Grimberg
2024-03-08 14:42 ` Christoph Hellwig
2024-03-08 16:20 ` Keith Busch

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.