From: jsg Date: Mon, 9 Sep 2024 09:32:06 +0000 (+0000) Subject: drm/amdgpu: fix dereference after null check X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=b2e9d6ba720a54e9d63c66d7820bc68ff2d7e576;p=openbsd drm/amdgpu: fix dereference after null check From Jesse Zhang 0aad97bf6d0bc7a34a19f266b0b9fb2861efe64c in linux-6.6.y/6.6.50 b1f7810b05d1950350ac2e06992982974343e441 in mainline linux --- diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c index 55095fd4897..79f4751f4af 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c @@ -5373,7 +5373,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)