[PATCH] vhost: fix checksum offset check in Rx path

Morten Brørup mb at smartsharesystems.com
Mon Oct 19 15:58:14 CEST 2026


Writing the checksum in the packet needs room for 2 bytes, not 1 byte.

Fixes: ca7036b4af3a ("vhost: fix offload flags in Rx path")
Cc: stable at dpdk.org

Signed-off-by: Morten Brørup <mb at smartsharesystems.com>
---
 lib/vhost/virtio_net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c
index 8bdddedccf..eb099d206b 100644
--- a/lib/vhost/virtio_net.c
+++ b/lib/vhost/virtio_net.c
@@ -2848,7 +2848,7 @@ vhost_dequeue_offload(struct virtio_net *dev, struct virtio_net_hdr *hdr,
 			if (likely(csum != 0xffff))
 				csum = ~csum;
 			off = hdr->csum_offset + hdr->csum_start;
-			if (rte_pktmbuf_data_len(m) >= off + 1)
+			if (rte_pktmbuf_data_len(m) >= off + sizeof(uint16_t))
 				*rte_pktmbuf_mtod_offset(m, uint16_t *, off) = csum;
 		}
 	}
-- 
2.43.0



More information about the dev mailing list