From c6c79fa425f12fbb7ebb57b53bd83dd00deeaf3e Mon Sep 17 00:00:00 2001 From: Konstantin Ananyev Date: Mon, 9 Jun 2014 18:26:14 +0100 Subject: [PATCH] e1000: do not release queue on alloc error If igb_alloc_rx_queue_mbufs() would fail to allocate an mbuf for RX queue, it calls igb_rx_queue_release(rxq). That causes rxq to be silently freed, without updating dev->data->rx_queues[]. So any further reference to it will trigger the SIGSEGV. Same thing in em PMD too. To fix: igb_alloc_rx_queue_mbufs() should just return an error to the caller and let upper layer to deal with the probem. That's what ixgbe PMD is doing right now. Signed-off-by: Konstantin Ananyev Acked-by: Thomas Monjalon --- lib/librte_pmd_e1000/em_rxtx.c | 1 - lib/librte_pmd_e1000/igb_rxtx.c | 1 - 2 files changed, 2 deletions(-) diff --git a/lib/librte_pmd_e1000/em_rxtx.c b/lib/librte_pmd_e1000/em_rxtx.c index 9707d6d542..1575e79a86 100644 --- a/lib/librte_pmd_e1000/em_rxtx.c +++ b/lib/librte_pmd_e1000/em_rxtx.c @@ -1580,7 +1580,6 @@ em_alloc_rx_queue_mbufs(struct em_rx_queue *rxq) if (mbuf == NULL) { PMD_INIT_LOG(ERR, "RX mbuf alloc failed " "queue_id=%hu\n", rxq->queue_id); - em_rx_queue_release(rxq); return (-ENOMEM); } diff --git a/lib/librte_pmd_e1000/igb_rxtx.c b/lib/librte_pmd_e1000/igb_rxtx.c index b53e7f74f7..74bfb1f45d 100644 --- a/lib/librte_pmd_e1000/igb_rxtx.c +++ b/lib/librte_pmd_e1000/igb_rxtx.c @@ -1818,7 +1818,6 @@ igb_alloc_rx_queue_mbufs(struct igb_rx_queue *rxq) if (mbuf == NULL) { PMD_INIT_LOG(ERR, "RX mbuf alloc failed " "queue_id=%hu\n", rxq->queue_id); - igb_rx_queue_release(rxq); return (-ENOMEM); } dma_addr = -- 2.20.1