Commit 2f7a3122 authored by Yuval Mintz's avatar Yuval Mintz Committed by David S. Miller
Browse files

bnx2x: Fix memory leak

There exists an `allocation race' between the CNIC and bnx2x drivers,
in which both drivers allocate the same t2 memory while disregarding a possible
previous allocation.

Additionally, due to the current order of memory releases, some of the
ILT memory in the driver is not released correctly when unloading the driver.

Signed-off-by: default avatarYuval Mintz <>
Signed-off-by: default avatarAriel Elior <>
Signed-off-by: default avatarEilon Greenstein <>
Signed-off-by: default avatarDavid S. Miller <>
parent f8f4f61a
......@@ -2934,9 +2934,9 @@ int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode, bool keep_link)
if (IS_PF(bp)) {
if (CNIC_LOADED(bp))
bp->state = BNX2X_STATE_CLOSED;
bp->cnic_loaded = false;
......@@ -7786,7 +7786,7 @@ int bnx2x_alloc_mem_cnic(struct bnx2x *bp)
if (CONFIGURE_NIC_MODE(bp) && !bp->t2)
/* allocate searcher T2 table, as it wan't allocated before */
BNX2X_PCI_ALLOC(bp->t2, &bp->t2_mapping, SRC_T2_SZ);
......@@ -7809,7 +7809,7 @@ int bnx2x_alloc_mem(struct bnx2x *bp)
int i, allocated, context_size;
if (!CONFIGURE_NIC_MODE(bp) && !bp->t2)
/* allocate searcher T2 table */
BNX2X_PCI_ALLOC(bp->t2, &bp->t2_mapping, SRC_T2_SZ);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment