From: John Daley Date: Tue, 19 Jul 2016 22:42:43 +0000 (-0700) Subject: net/enic: fix possible Rx corruption X-Git-Tag: spdx-start~6117 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=1ccc51b079c4e36d5701dc1500b2aafa1235858e;p=dpdk.git net/enic: fix possible Rx corruption Initialize the mbuf data offset to RTE_PKTMBUF_HEADROOM as the enic takes ownership of them. If allocated mbufs had some offset other than RTE_PKTMBUF_HEADROOM, the application would read mbuf data starting at the wrong place and misinterpret the packet. Fixes: 856d7ba7ed22 ("net/enic: support scattered Rx") Reviewed-by: Nelson Escobar Signed-off-by: John Daley --- diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index 542f0952be..b4ca371049 100644 --- a/drivers/net/enic/enic_main.c +++ b/drivers/net/enic/enic_main.c @@ -317,6 +317,7 @@ enic_alloc_rx_queue_mbufs(struct enic *enic, struct vnic_rq *rq) return -ENOMEM; } + mb->data_off = RTE_PKTMBUF_HEADROOM; dma_addr = (dma_addr_t)(mb->buf_physaddr + RTE_PKTMBUF_HEADROOM); rq_enet_desc_enc(rqd, dma_addr, diff --git a/drivers/net/enic/enic_rxtx.c b/drivers/net/enic/enic_rxtx.c index 845a8e6691..50f0b2873b 100644 --- a/drivers/net/enic/enic_rxtx.c +++ b/drivers/net/enic/enic_rxtx.c @@ -300,6 +300,7 @@ enic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, (struct cq_enet_rq_desc *)&cqd); /* Push descriptor for newly allocated mbuf */ + nmb->data_off = RTE_PKTMBUF_HEADROOM; dma_addr = (dma_addr_t)(nmb->buf_physaddr + RTE_PKTMBUF_HEADROOM); rq_enet_desc_enc(rqd_ptr, dma_addr,