nvmet-tcp: do not continue for invalid icreq
Subsystems (2)
PATCH 1/1 nvmet-tcp: do not continue for invalid icreq
From: Hannes Reinecke <[email protected]>
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.
--- drivers/nvme/target/tcp.c | 1 + 1 file changed, 1 insertion(+)
drivers/nvme/target/tcp.c +1 -0
@@ -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 ) {
Signature · 1 line
2.35.3
Quoted 5 lines · On 1/11/24 23:23, [email protected] wrote:
From: Hannes Reinecke <[email protected]>
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.
Quoted 10 lines
Signed-off-by Hannes Reinecke <[email protected]>--- drivers/nvme/target/tcp.c | 1 + 1 file changed, 1 insertion(+)drivers/nvme/target/tcp.c +0
-0
drivers/nvme/target/tcp.c static int nvmet_tcp_handle_icreq(struct nvmet_tcp_queue *queue) · line 904
Quoted 7 lines
drivers/nvme/target/tcp.c +1
-0@@ -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.
-ck