drm/amdgpu: guard against failed kfd node init
Subsystems (3)
PATCH 1/1 drm/amdgpu: guard against failed kfd node init
before kfd_dev_unmap_mapping_range check ptr to avoid null pointer
from failed or incomplete kfd node init.
Signed-off-by Yiqing Yao <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +6 -1
@@ -330,11 +330,16 @@ void amdgpu_amdkfd_clear_kfd_mapping(struct amdgpu_device *adev)struct kfd_dev *kfd = adev->kfd.dev;unsigned int i; -if (!kfd) +/* kfd->num_nodes is set before kfd->nodes[] is populated, so a failed +* or incomplete kgd2kfd_device_init() leaves NULL node pointers behind +*/ +if (!kfd || !adev->kfd.init_complete)return ;for (i =0 ; i < kfd->num_nodes; i++) {struct kfd_node *node = kfd->nodes[i]; +if (!node) +continue ; kfd_dev_unmap_mapping_range(KFD_MMAP_TYPE_DOORBELL | KFD_MMAP_GPU_ID(node->id),
Signature · 1 line
2.34.1