drm/amdgpu: fix dereference after null check
authorjsg <jsg@openbsd.org>
Mon, 9 Sep 2024 09:32:06 +0000 (09:32 +0000)
committerjsg <jsg@openbsd.org>
Mon, 9 Sep 2024 09:32:06 +0000 (09:32 +0000)
From Jesse Zhang
0aad97bf6d0bc7a34a19f266b0b9fb2861efe64c in linux-6.6.y/6.6.50
b1f7810b05d1950350ac2e06992982974343e441 in mainline linux

sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c

index 55095fd..79f4751 100644 (file)
@@ -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)