Skip to content

Commit 9bb392e

Browse files
dinghaoliugregkh
authored andcommitted
qed: Fix a potential use-after-free in qed_cxt_tables_alloc
[ Upstream commit b65d52a ] 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") Reviewed-by: Przemek Kitszel <[email protected]> Signed-off-by: Dinghao Liu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 112792a commit 9bb392e

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)