Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdkfd: Fix NULL pointer dereference

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>

authored by

Felix Kuehling and committed by
Alex Deucher
3cd3e731 dac1655c

+1 -1
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
··· 727 727 728 728 bool amdgpu_amdkfd_ras_query_utcl2_poison_status(struct amdgpu_device *adev) 729 729 { 730 - if (adev->gfx.ras->query_utcl2_poison_status) 730 + if (adev->gfx.ras && adev->gfx.ras->query_utcl2_poison_status) 731 731 return adev->gfx.ras->query_utcl2_poison_status(adev); 732 732 else 733 733 return false;