]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
bnxt_en: Fix aggregation buffer leak under OOM condition.
authorMichael Chan <michael.chan@broadcom.com>
Wed, 22 May 2019 23:12:54 +0000 (19:12 -0400)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 13 Aug 2019 12:11:36 +0000 (14:11 +0200)
BugLink: https://bugs.launchpad.net/bugs/1837518
[ Upstream commit 296d5b54163964b7ae536b8b57dfbd21d4e868e1 ]

For every RX packet, the driver replenishes all buffers used for that
packet and puts them back into the RX ring and RX aggregation ring.
In one code path where the RX packet has one RX buffer and one or more
aggregation buffers, we missed recycling the aggregation buffer(s) if
we are unable to allocate a new SKB buffer.  This leads to the
aggregation ring slowly running out of buffers over time.  Fix it
by properly recycling the aggregation buffers.

Fixes: c0c050c58d84 ("bnxt_en: New Broadcom ethernet driver.")
Reported-by: Rakesh Hemnani <rhemnani@fb.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/net/ethernet/broadcom/bnxt/bnxt.c

index c6ddbc0e084ef6fac122c6ff2edc11f3b6593ea9..d45b2f0e3063c85a99867a2fc4a3053ea37f942b 100644 (file)
@@ -1636,6 +1636,8 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
                skb = bnxt_copy_skb(bnapi, data_ptr, len, dma_addr);
                bnxt_reuse_rx_data(rxr, cons, data);
                if (!skb) {
+                       if (agg_bufs)
+                               bnxt_reuse_rx_agg_bufs(cpr, cp_cons, agg_bufs);
                        rc = -ENOMEM;
                        goto next_rx;
                }