Subject: [PATCH V1 net 1/2] net: ena: xdp: XDP_TX: fix memory leak

From: <[email-masked]>
Date: Tue, 2 Jun 2020 13:21:50 +0000

From: Sameeh Jubran <[email-masked]>

When sending very high packet rate, the XDP tx queues can get full and
start dropping packets. In this case we don't free the pages which
results in ena driver draining the system memory.

Fix:
Simply free the pages when necessary.

Fixes: cad451dd2427 ("net: ena: Implement XDP_TX action")
Signed-off-by: Sameeh Jubran <[email-masked]>
---
 drivers/net/ethernet/amazon/ena/ena_netdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
index 281896542..ec115b753 100644
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
@@ -355,7 +355,7 @@ error_unmap_dma:
 	ena_unmap_tx_buff(xdp_ring, tx_info);
 	tx_info->xdpf = NULL;
 error_drop_packet:
-
+	__free_page(tx_info->xdp_rx_page);
 	return NETDEV_TX_OK;
 }
 
-- 
2.24.1.AMZN