]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: ena: xdp: XDP_TX: fix memory leak
authorSameeh Jubran <sameehj@amazon.com>
Wed, 3 Jun 2020 08:50:22 +0000 (08:50 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Jun 2020 14:41:48 +0000 (16:41 +0200)
[ Upstream commit cd07ecccba13b8bd5023ffe7be57363d07e3105f ]

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: 548c4940b9f1 ("net: ena: Implement XDP_TX action")
Signed-off-by: Sameeh Jubran <sameehj@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/amazon/ena/ena_netdev.c

index cada6e7e30f4e43f6f4dcaec978020ee15a530e1..48449efb6039fd4b6175c69ec712e8c71dd24bda 100644 (file)
@@ -358,7 +358,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;
 }