From 2732e07ad1e54c648c8ca5bc6965af5bf607ba10 Mon Sep 17 00:00:00 2001 From: Michal Krawczyk Date: Mon, 10 Apr 2017 16:28:10 +0200 Subject: [PATCH] net/ena: cleanup if refilling of Rx descriptors fails If wrong number of descriptors for refilling was passed to the Rx repopulate function, there was memory leak which caused memory pool to run out of resources in longer go. In case of fail when refilling Rx descriptors, all additional mbufs have to be released. Fixes: 1173fca25af9 ("ena: add polling-mode driver") Cc: stable@dpdk.org Signed-off-by: Michal Krawczyk Reviewed-by: Jakub Palider Acked-by: Jan Medala --- drivers/net/ena/ena_ethdev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index 55f5191226..3334f1b51c 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -1173,6 +1173,8 @@ static int ena_populate_rx_queue(struct ena_ring *rxq, unsigned int count) rc = ena_com_add_single_rx_desc(rxq->ena_com_io_sq, &ebuf, next_to_use_masked); if (unlikely(rc)) { + rte_mempool_put_bulk(rxq->mb_pool, (void **)(&mbuf), + count - i); RTE_LOG(WARNING, PMD, "failed adding rx desc\n"); break; } -- 2.20.1