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

drm/amdgpu: Fix a deadlock if previous GEM object allocation fails

Fall through to handle the error instead of return.

Fixes: f8aab60422c37 ("drm/amdgpu: Initialise drm_gem_object_funcs for imported BOs")
Cc: stable@vger.kernel.org
Signed-off-by: xinhui pan <xinhui.pan@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

xinhui pan and committed by
Alex Deucher
703677d9 f7d6779d

+11 -14
+11 -14
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
··· 341 341 r = amdgpu_gem_object_create(adev, size, args->in.alignment, 342 342 initial_domain, 343 343 flags, ttm_bo_type_device, resv, &gobj); 344 - if (r) { 345 - if (r != -ERESTARTSYS) { 346 - if (flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED) { 347 - flags &= ~AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED; 348 - goto retry; 349 - } 350 - 351 - if (initial_domain == AMDGPU_GEM_DOMAIN_VRAM) { 352 - initial_domain |= AMDGPU_GEM_DOMAIN_GTT; 353 - goto retry; 354 - } 355 - DRM_DEBUG("Failed to allocate GEM object (%llu, %d, %llu, %d)\n", 356 - size, initial_domain, args->in.alignment, r); 344 + if (r && r != -ERESTARTSYS) { 345 + if (flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED) { 346 + flags &= ~AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED; 347 + goto retry; 357 348 } 358 - return r; 349 + 350 + if (initial_domain == AMDGPU_GEM_DOMAIN_VRAM) { 351 + initial_domain |= AMDGPU_GEM_DOMAIN_GTT; 352 + goto retry; 353 + } 354 + DRM_DEBUG("Failed to allocate GEM object (%llu, %d, %llu, %d)\n", 355 + size, initial_domain, args->in.alignment, r); 359 356 } 360 357 361 358 if (flags & AMDGPU_GEM_CREATE_VM_ALWAYS_VALID) {