bo_do_create will unreserve in in the end if @resv is NULL, which cause the following bo_create_shadow run without lock held on @resv Change-Id: Iaad24b8aea60522f25188874ab9d5c5f13f1a941 Signed-off-by: Monk Liu <Monk.Liu at amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index 216799cc..d8a818d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c @@ -507,9 +507,12 @@ int amdgpu_bo_create(struct amdgpu_device *adev, return r; if ((flags & AMDGPU_GEM_CREATE_SHADOW) && amdgpu_need_backup(adev)) { - if (!resv) - WARN_ON(reservation_object_lock((*bo_ptr)->tbo.resv, - NULL)); + if (!resv) { + WARN_ON(reservation_object_lock((*bo_ptr)->tbo.resv, NULL)); + r = amdgpu_bo_reserve(*bo_ptr, kernel?true:false); + if (unlikely(r)) + return r; + } r = amdgpu_bo_create_shadow(adev, size, byte_align, (*bo_ptr)); -- 2.7.4