]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amdgpu: fix dereference after null check
authorJesse Zhang <jesse.zhang@amd.com>
Wed, 8 May 2024 06:51:35 +0000 (14:51 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 13 May 2024 20:11:52 +0000 (16:11 -0400)
check the pointer hive before use.

Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
Reviewed-by: Tim Huang <Tim.Huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

index 77f6fd50002acd823346fd5184473f9ddc27df00..00fe3c2d54310f7d791b8c54c448ef9581cfa22a 100644 (file)
@@ -5725,7 +5725,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 (adev->shutdown)