bnxt_en: Fix possible crash in bnxt_fw_reset_task().
authorMichael Chan <michael.chan@broadcom.com>
Wed, 26 Aug 2020 05:08:36 +0000 (01:08 -0400)
committerDavid S. Miller <davem@davemloft.net>
Wed, 26 Aug 2020 14:19:03 +0000 (07:19 -0700)
commitb148bb238c02f0c7797efed026e9bba5892d2172
treec065ceea1f1f0821ec18063eb708b736e7e8480e
parentdf3875ec550396974b1d8a518bd120d034738236
bnxt_en: Fix possible crash in bnxt_fw_reset_task().

bnxt_fw_reset_task() is run from a delayed workqueue.  The current
code is not cancelling the workqueue in the driver's .remove()
method and it can potentially crash if the device is removed with
the workqueue still pending.

The fix is to clear the BNXT_STATE_IN_FW_RESET flag and then cancel
the delayed workqueue in bnxt_remove_one().  bnxt_queue_fw_reset_work()
also needs to check that this flag is set before scheduling.  This
will guarantee that no rescheduling will be done after it is cancelled.

Fixes: 230d1f0de754 ("bnxt_en: Handle firmware reset.")
Reviewed-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
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