]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
bnxt_en: Fix NULL pointer dereference at bnxt_free_irq().
authorMichael Chan <michael.chan@broadcom.com>
Wed, 11 Apr 2018 15:50:18 +0000 (11:50 -0400)
committerBrian Maly <brian.maly@oracle.com>
Wed, 27 Feb 2019 19:46:56 +0000 (14:46 -0500)
Orabug: 29357977

When open fails during ethtool -L ring change, for example, the driver
may crash at bnxt_free_irq() because bp->bnapi is NULL.

If we fail to allocate all the new rings, bnxt_open_nic() will free
all the memory including bp->bnapi.  Subsequent call to bnxt_close_nic()
will try to dereference bp->bnapi in bnxt_free_irq().

Fix it by checking for !bp->bnapi in bnxt_free_irq().

Fixes: e5811b8c09df ("bnxt_en: Add IRQ remapping logic.")
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit cb98526bf9b985866d648dbb9c983ba9eb59daba)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
drivers/net/ethernet/broadcom/bnxt/bnxt.c

index 700c4e7cbe98818fc92ba673fba731c6b367f879..50b47e3685596f9c2e84bee8f11f053c918fb7ea 100644 (file)
@@ -5913,7 +5913,7 @@ static void bnxt_free_irq(struct bnxt *bp)
        free_irq_cpu_rmap(bp->dev->rx_cpu_rmap);
        bp->dev->rx_cpu_rmap = NULL;
 #endif
-       if (!bp->irq_tbl)
+       if (!bp->irq_tbl || !bp->bnapi)
                return;
 
        for (i = 0; i < bp->cp_nr_rings; i++) {