summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Dyasly <s.dyasly@samsung.com>2016-07-21 14:03:38 +0300
committerThomas Monjalon <thomas.monjalon@6wind.com>2016-07-22 01:32:17 +0200
commita280e64c08ee5ac8abcb94db7744119b83147da6 (patch)
treee9885ab6cc0fa6eb5dd6c298f4ae33ac0f15ddb4
parent0d71010d5cbf87982df65435b832d3f9e8a63ce0 (diff)
downloaddpdk-a280e64c08ee5ac8abcb94db7744119b83147da6.zip
dpdk-a280e64c08ee5ac8abcb94db7744119b83147da6.tar.gz
dpdk-a280e64c08ee5ac8abcb94db7744119b83147da6.tar.xz
net/i40e: fix out-of-bounds writes in vector Rx
Rx loop inside _recv_raw_pkts_vec() ignores nb_pkts argument and always tries to receive RTE_I40E_VPMD_RX_BURST (32) packets. This is a violation of rte_eth_rx_burst() API and can lead to memory corruption (out-of-bounds writes to struct rte_mbuf **rx_pkts) if nb_pkts is less than 32. Fix this by actually using nb_pkts inside the loop. Fixes: 9ed94e5bb04e ("i40e: add vector Rx") Signed-off-by: Sergey Dyasly <s.dyasly@samsung.com> Acked-by: Ilya Maximets <i.maximets@samsung.com> Acked-by: Adam Bynes <adambynes@outlook.com>
-rw-r--r--drivers/net/i40e/i40e_rxtx_vec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/i40e/i40e_rxtx_vec.c b/drivers/net/i40e/i40e_rxtx_vec.c
index 05cb415..51fb282 100644
--- a/drivers/net/i40e/i40e_rxtx_vec.c
+++ b/drivers/net/i40e/i40e_rxtx_vec.c
@@ -269,7 +269,7 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,
* D. fill info. from desc to mbuf
*/
- for (pos = 0, nb_pkts_recd = 0; pos < RTE_I40E_VPMD_RX_BURST;
+ for (pos = 0, nb_pkts_recd = 0; pos < nb_pkts;
pos += RTE_I40E_DESCS_PER_LOOP,
rxdp += RTE_I40E_DESCS_PER_LOOP) {
__m128i descs[RTE_I40E_DESCS_PER_LOOP];