From: Michal Krawczyk Date: Mon, 10 Apr 2017 14:28:10 +0000 (+0200) Subject: net/ena: cleanup if refilling of Rx descriptors fails X-Git-Tag: spdx-start~3596 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=2732e07ad1e54c648c8ca5bc6965af5bf607ba10;p=dpdk.git 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 --- 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; }