Commit c08014a2 authored by Jesse Zhang's avatar Jesse Zhang Committed by Liu Chuang
Browse files

drm/amdgpu: fix dereference after null check

stable inclusion
from stable-v6.6.50
commit 0aad97bf6d0bc7a34a19f266b0b9fb2861efe64c
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IARVHE
CVE: CVE-2024-46720

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0aad97bf6d0bc7a34a19f266b0b9fb2861efe64c



--------------------------------

[ Upstream commit b1f7810b05d1950350ac2e06992982974343e441 ]

check the pointer hive before use.

Signed-off-by: default avatarJesse Zhang <Jesse.Zhang@amd.com>
Reviewed-by: default avatarTim Huang <Tim.Huang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarLiu Chuang <liuchuang40@huawei.com>
parent 7ab021d4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -5235,7 +5235,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
	 * to put adev in the 1st position.
	 */
	INIT_LIST_HEAD(&device_list);
	if (!amdgpu_sriov_vf(adev) && (adev->gmc.xgmi.num_physical_nodes > 1)) {
	if (!amdgpu_sriov_vf(adev) && (adev->gmc.xgmi.num_physical_nodes > 1) && hive) {
		list_for_each_entry(tmp_adev, &hive->device_list, gmc.xgmi.head) {
			list_add_tail(&tmp_adev->reset_list, &device_list);
			if (gpu_reset_for_dev_remove && adev->shutdown)