]> git.baikalelectronics.ru Git - kernel.git/commit
bnxt_en: Fix possible crash in bnxt_hwrm_ring_free() under error conditions.
authorMichael Chan <michael.chan@broadcom.com>
Fri, 26 Apr 2019 02:31:52 +0000 (22:31 -0400)
committerDavid S. Miller <davem@davemloft.net>
Sat, 27 Apr 2019 21:00:18 +0000 (17:00 -0400)
commit60e8187672a723bcee1ad227d13c7cfb8411ebc4
treedf19e6efe993d6bdcd7bf782091a97fe7b5bff60
parent61936f8bc83a5a4f565ca715d0fc23bc28589d61
bnxt_en: Fix possible crash in bnxt_hwrm_ring_free() under error conditions.

If we encounter errors during open and proceed to clean up,
bnxt_hwrm_ring_free() may crash if the rings we try to free have never
been allocated.  bnxt_cp_ring_for_rx() or bnxt_cp_ring_for_tx()
may reference pointers that have not been allocated.

Fix it by checking for valid fw_ring_id first before calling
bnxt_cp_ring_for_rx() or bnxt_cp_ring_for_tx().

Fixes: e4066356080e ("bnxt_en: Add helper functions to get firmware CP ring ID.")
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