summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonk Liu <Monk.Liu@amd.com>2017-08-08 16:16:29 +0800
committerMonk Liu <Monk.Liu@amd.com>2017-08-10 13:17:32 +0800
commiteaea24b7acfb8d2cb1db8baa8f353d9fcc69a2b6 (patch)
tree411ddfb6f7a065e58501c091d54a8f8be15e4359
parente53d1bf32e1f449383939fb89e2771eff5fda98a (diff)
amdgpu:fix potential deadlock
deadlock could occure between cpu mutex lock and bo table mutex lock, this patch avoid it. Change-Id: I083e402dde48f02a8ee196e59aa0cab80849fc18 Signed-off-by: Monk Liu <Monk.Liu@amd.com> Acked-by: Qiang Yu <Qiang.Yu@amd.com>
-rw-r--r--amdgpu/amdgpu_bo.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c
index 09028c73..c973a0d0 100644
--- a/amdgpu/amdgpu_bo.c
+++ b/amdgpu/amdgpu_bo.c
@@ -673,10 +673,10 @@ int amdgpu_bo_cpu_map(amdgpu_bo_handle bo, void **cpu)
pthread_mutex_unlock(&bo->cpu_access_mutex);
return -errno;
}
- amdgpu_add_handle_to_table(bo);
bo->cpu_ptr = ptr;
bo->cpu_map_count = 1;
pthread_mutex_unlock(&bo->cpu_access_mutex);
+ amdgpu_add_handle_to_table(bo);
*cpu = ptr;
return 0;