nvmet-tcp: do not continue for invalid icreq
authorHannes Reinecke <hare@suse.de>
Fri, 8 Mar 2024 07:11:05 +0000 (08:11 +0100)
committerKeith Busch <kbusch@kernel.org>
Fri, 8 Mar 2024 14:49:57 +0000 (06:49 -0800)
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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/target/tcp.c

index c8655fc..022d17b 100644 (file)
@@ -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) {