]> git.baikalelectronics.ru Git - kernel.git/commit
bnxt_en: Clean up completion ring page arrays completely
authorMichael Chan <michael.chan@broadcom.com>
Sun, 12 Sep 2021 16:34:49 +0000 (12:34 -0400)
committerDavid S. Miller <davem@davemloft.net>
Mon, 13 Sep 2021 11:31:13 +0000 (12:31 +0100)
commit1df3a0999199fbf99722db46ed99d575b4ac2b42
treee21ec6d727cc7d6cf5cf97f0f6dba9d1719739ac
parent4d8d0f6a66885c002ee36b2ce8101f038a3d8fba
bnxt_en: Clean up completion ring page arrays completely

We recently changed the completion ring page arrays to be dynamically
allocated to better support the expanded range of ring depths.  The
cleanup path for this was not quite complete.  It might cause the
shutdown path to crash if we need to abort before the completion ring
arrays have been allocated and initialized.

Fix it by initializing the ring_mem->pg_arr to NULL after freeing the
completion ring page array.  Add a check in bnxt_free_ring() to skip
referencing the rmem->pg_arr if it is NULL.

Fixes: 9c436bdaf4a5 ("bnxt_en: Don't use static arrays for completion ring pages")
Reviewed-by: Andy Gospodarek <gospo@broadcom.com>
Reviewed-by: Edwin Peer <edwin.peer@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