diff mbox

[libdrm,2/2] amdgpu: Fix segfault in deadlock test.

Message ID 1516903859-3679-2-git-send-email-andrey.grodzovsky@amd.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andrey Grodzovsky Jan. 25, 2018, 6:10 p.m. UTC
If amdgpu_cs_query_fence_status terminates prematurely the BO
sometimes is unmapped before helper thread writes a vlaue
into it causing a segfault.

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
---
 tests/amdgpu/deadlock_tests.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/tests/amdgpu/deadlock_tests.c b/tests/amdgpu/deadlock_tests.c
index 9a42885..fc49c48 100644
--- a/tests/amdgpu/deadlock_tests.c
+++ b/tests/amdgpu/deadlock_tests.c
@@ -245,6 +245,8 @@  static void amdgpu_deadlock_helper(unsigned ip_type)
 			AMDGPU_TIMEOUT_INFINITE,0, &expired);
 	CU_ASSERT_EQUAL((r == 0 || r == -ECANCELED), 1);
 
+	pthread_join(stress_thread, NULL);
+
 	r = amdgpu_bo_list_destroy(bo_list);
 	CU_ASSERT_EQUAL(r, 0);
 
@@ -254,6 +256,4 @@  static void amdgpu_deadlock_helper(unsigned ip_type)
 
 	r = amdgpu_cs_ctx_free(context_handle);
 	CU_ASSERT_EQUAL(r, 0);
-
-	pthread_join(stress_thread, NULL);
 }