]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
nvmet-tcp: do not continue for invalid icreq
authorHannes Reinecke <hare@suse.de>
Fri, 8 Mar 2024 07:11:05 +0000 (08:11 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 Sep 2024 11:17:38 +0000 (13:17 +0200)
[ Upstream commit 0889d13b9e1cbef49e802ae09f3b516911ad82a1 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvme/target/tcp.c

index d70a2fa4ba45f92720c5fd850934449e8af01d10..e493fc709065ad5696576aa165f7978536ac7302 100644 (file)
@@ -846,6 +846,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) {