drm/amdkfd: Fix NULL pointer dereference
authorFelix Kuehling <Felix.Kuehling@amd.com>
Wed, 6 Apr 2022 20:58:24 +0000 (16:58 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 7 Apr 2022 20:37:39 +0000 (16:37 -0400)
Check that adev->gfx.ras is valid before using it.

Fixes: 6475ae2b742876 ("drm/amdgpu: add UTCL2 RAS poison query for Aldebaran (v2)")
CC: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Mukul Joshi <mukul.joshi@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c

index c18c4be..64c6664 100644 (file)
@@ -727,7 +727,7 @@ void amdgpu_amdkfd_ras_poison_consumption_handler(struct amdgpu_device *adev, bo
 
 bool amdgpu_amdkfd_ras_query_utcl2_poison_status(struct amdgpu_device *adev)
 {
-       if (adev->gfx.ras->query_utcl2_poison_status)
+       if (adev->gfx.ras && adev->gfx.ras->query_utcl2_poison_status)
                return adev->gfx.ras->query_utcl2_poison_status(adev);
        else
                return false;