Commit 4ff12d82 authored by Haoxiang Li's avatar Haoxiang Li Committed by Tony Nguyen
Browse files

ice: Fix a null pointer dereference in ice_copy_and_init_pkg()



Add check for the return value of devm_kmemdup()
to prevent potential null pointer dereference.

Fixes: c7648810 ("ice: Implement Dynamic Device Personalization (DDP) download")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarHaoxiang Li <haoxiang_li2024@163.com>
Reviewed-by: default avatarMichal Swiatkowski <michal.swiatkowski@linux.intel.com>
Reviewed-by: default avatarAleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Tested-by: Rinitha S <sx.rinitha@intel.com> (A Contingent worker at Intel)
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
parent 5a0df029
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -2301,6 +2301,8 @@ enum ice_ddp_state ice_copy_and_init_pkg(struct ice_hw *hw, const u8 *buf,
		return ICE_DDP_PKG_ERR;

	buf_copy = devm_kmemdup(ice_hw_to_dev(hw), buf, len, GFP_KERNEL);
	if (!buf_copy)
		return ICE_DDP_PKG_ERR;

	state = ice_init_pkg(hw, buf_copy, len);
	if (!ice_is_init_pkg_successful(state)) {