Skip to content

Commit 59a4f9e

Browse files
dinghaoliuNipaLocal
authored and
NipaLocal
committed
qed: Fix a potential use-after-free in qed_cxt_tables_alloc
qed_ilt_shadow_alloc() will call qed_ilt_shadow_free() to free p_hwfn->p_cxt_mngr->ilt_shadow on error. However, qed_cxt_tables_alloc() accesses the freed pointer on failure of qed_ilt_shadow_alloc() through calling qed_cxt_mngr_free(), which may lead to use-after-free. Fix this issue by setting p_mngr->ilt_shadow to NULL in qed_ilt_shadow_free(). Fixes: fe56b9e ("qed: Add module with basic common support") Signed-off-by: Dinghao Liu <[email protected]> Signed-off-by: NipaLocal <nipa@local>
1 parent dc5e2e6 commit 59a4f9e

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/net/ethernet/qlogic/qed/qed_cxt.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,7 @@ static void qed_ilt_shadow_free(struct qed_hwfn *p_hwfn)
933933
p_dma->virt_addr = NULL;
934934
}
935935
kfree(p_mngr->ilt_shadow);
936+
p_mngr->ilt_shadow = NULL;
936937
}
937938

938939
static int qed_ilt_blk_alloc(struct qed_hwfn *p_hwfn,

0 commit comments

Comments
 (0)