From: Michael Chan Date: Tue, 10 Dec 2019 07:49:08 +0000 (-0500) Subject: bnxt_en: Free context memory in the open path if firmware has been reset. X-Git-Tag: v5.4.8~34 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=afc13aa9400b5d3d54efa4b4183168a9a3e03c12;p=thirdparty%2Fkernel%2Fstable.git bnxt_en: Free context memory in the open path if firmware has been reset. [ Upstream commit 325f85f37e5b35807d86185bdf2c64d2980c44ba ] This will trigger new context memory to be rediscovered and allocated during the re-probe process after a firmware reset. Without this, the newly reset firmware does not have valid context memory and the driver will eventually fail to allocate some resources. Fixes: ec5d31e3c15d ("bnxt_en: Handle firmware reset status during IF_UP.") Signed-off-by: Michael Chan Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 527e1bf931160..a23f582442e0b 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -8766,6 +8766,9 @@ static int bnxt_hwrm_if_change(struct bnxt *bp, bool up) } if (resc_reinit || fw_reset) { if (fw_reset) { + bnxt_free_ctx_mem(bp); + kfree(bp->ctx); + bp->ctx = NULL; rc = bnxt_fw_init_one(bp); if (rc) { set_bit(BNXT_STATE_ABORT_ERR, &bp->state);