ixgbe: fix buffer overrun in non-bulk alloc mode
authorPawel Wodkowski <pawelx.wdkowski@intel.com>
Thu, 19 Mar 2015 16:09:16 +0000 (17:09 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Fri, 20 Mar 2015 21:42:51 +0000 (22:42 +0100)
When bulk alloc is enabled at compile time but preconditions for
it are not met at runtime the ixgbe_reset_rx_queue() function
overrides rxq->sw_ring not allocated elements.

Fixes: 01fa1d6215fa ("ixgbe: unify Rx setup")

Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
lib/librte_pmd_ixgbe/ixgbe_rxtx.c

index 7b603d0..9da2c7e 100644 (file)
@@ -2122,8 +2122,8 @@ ixgbe_reset_rx_queue(struct ixgbe_hw *hw, struct ixgbe_rx_queue *rxq)
         * entries is always allocated
         */
        memset(&rxq->fake_mbuf, 0x0, sizeof(rxq->fake_mbuf));
-       for (i = 0; i < RTE_PMD_IXGBE_RX_MAX_BURST; ++i) {
-               rxq->sw_ring[rxq->nb_rx_desc + i].mbuf = &rxq->fake_mbuf;
+       for (i = rxq->nb_rx_desc; i < len; ++i) {
+               rxq->sw_ring[i].mbuf = &rxq->fake_mbuf;
        }
 
        rxq->rx_nb_avail = 0;