[PATCH] nvmet-tcp: do not continue for invalid icreq

Chaitanya Kulkarni chaitanyak at nvidia.com
Mon Jan 15 14:11:37 PST 2024


On 1/11/24 23:23, hare at kernel.org wrote:
> From: Hannes Reinecke <hare at 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 at 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 at nvidia.com>

-ck




More information about the Linux-nvme mailing list