]> git.baikalelectronics.ru Git - kernel.git/commit
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)
committerDavid S. Miller <davem@davemloft.net>
Wed, 11 Apr 2018 18:42:00 +0000 (14:42 -0400)
commit7442c0085e1f240ad3f3a0659df34683d9d7ba87
tree40224fb747b9e4a9733c6a4874815eff998da672
parent14ac4d1522e350ac17d6b25ae26d0d5924aa7b5b
bnxt_en: Fix NULL pointer dereference at bnxt_free_irq().

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: fb4f65562882 ("bnxt_en: Add IRQ remapping logic.")
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnxt/bnxt.c