]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
qed: Fix a potential use-after-free in qed_cxt_tables_alloc
authorDinghao Liu <dinghao.liu@zju.edu.cn>
Sun, 10 Dec 2023 04:52:55 +0000 (12:52 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Dec 2023 14:17:36 +0000 (15:17 +0100)
commitd3b174db0cd6577a60add21b236a8a76c71bbc68
tree4e56a5fb9bec046c0d3c7d0a3503f6aaf7fe70cc
parent3f1f6a94d8858706863fe90da35663f6e24be274
qed: Fix a potential use-after-free in qed_cxt_tables_alloc

[ Upstream commit b65d52ac9c085c0c52dee012a210d4e2f352611b ]

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: fe56b9e6a8d9 ("qed: Add module with basic common support")
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Link: https://lore.kernel.org/r/20231210045255.21383-1-dinghao.liu@zju.edu.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/qlogic/qed/qed_cxt.c