Skip to content

Commit 5d9d500

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 3df8126 commit 5d9d500

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
@@ -1023,6 +1023,7 @@ static void qed_ilt_shadow_free(struct qed_hwfn *p_hwfn)
10231023
p_dma->p_virt = NULL;
10241024
}
10251025
kfree(p_mngr->ilt_shadow);
1026+
p_mngr->ilt_shadow = NULL;
10261027
}
10271028

10281029
static int qed_ilt_blk_alloc(struct qed_hwfn *p_hwfn,

0 commit comments

Comments
 (0)