浏览代码

drm/amd/amdgpu: fix locking in bo creation error path

Unlock the resv lock only if we were the ones to lock it in the first
place.

Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Nicolai Hähnle 8 年之前
父节点
当前提交
f1543f58cb
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      drivers/gpu/drm/amd/amdgpu/amdgpu_object.c

+ 2 - 1
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c

@@ -408,7 +408,8 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev,
 	return 0;
 
 fail_unreserve:
-	ww_mutex_unlock(&bo->tbo.resv->lock);
+	if (!resv)
+		ww_mutex_unlock(&bo->tbo.resv->lock);
 	amdgpu_bo_unref(&bo);
 	return r;
 }