Skip to contentSkip to conversation

nvmet-tcp: fix a missing endianess conversion in nvmet_tcp_try_peek_pdu

PATCH Applied Christoph Hellwig 3 participants 3 messages Dec 26, 2023 – Jan 2, 2024

Subsystems (2)
lore
Share & tools
lore

Christoph Hellwig

author maintainer
#0 lore raw

PATCH 1/1 nvmet-tcp: fix a missing endianess conversion in nvmet_tcp_try_peek_pdu

No, a __le32 cast doesn't magically byteswap on big-endian systems..

Fixes 70525e5d82f6 ("nvmet-tcp: peek icreq before starting TLS")
---
 drivers/nvme/target/tcp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/target/tcp.c +1 -1
index 4cc27856aa8fef..edf3b3d54a9330 100644
@@ -1768,7 +1768,7 @@ static int nvmet_tcp_try_peek_pdu(struct nvmet_tcp_queue *queue)
 		 (int)sizeof(struct nvme_tcp_icreq_pdu));
 	if (hdr->type == nvme_tcp_icreq &&
 	    hdr->hlen == sizeof(struct nvme_tcp_icreq_pdu) &&
-	    hdr->plen == (__le32)sizeof(struct nvme_tcp_icreq_pdu)) {
+	    hdr->plen == cpu_to_le32(sizeof(struct nvme_tcp_icreq_pdu))) {
 		pr_debug("queue %d: icreq detected\n",
 			 queue->idx);
 		return len;
Signature · 1 line
2.39.2
maintainer Applied
#2 lore raw
In reply to Christoph Hellwig
Quoted 3 lines · Christoph Hellwig

No, a __le32 cast doesn't magically byteswap on big-endian systems..

Fixes 70525e5d82f6 ("nvmet-tcp: peek icreq before starting TLS")

Thanks, applied to nvme-6.8.