[Intel-gfx] [PATCH i-g-t] tests/drm_import_export: Always loop with mutex held
Mika Kuoppala
mika.kuoppala at linux.intel.com
Wed Nov 25 05:20:26 PST 2015
We assume that lock is held on start of the loop scope.
Some paths continuing inside loop didn't adhere to this
assumption, causing segfault on unlocking an already
unlocked mutex. Fix this by re-aquiring lock always.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93013
Cc: MichaĆ Winiarski <michal.winiarski at intel.com>
Cc: Thomas Wood <thomas.wood at intel.com>
Signed-off-by: Mika Kuoppala <mika.kuoppala at intel.com>
---
tests/drm_import_export.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tests/drm_import_export.c b/tests/drm_import_export.c
index 49486ab..cfe5f6d 100644
--- a/tests/drm_import_export.c
+++ b/tests/drm_import_export.c
@@ -161,20 +161,20 @@ static void *import_close_thread(void *data)
pthread_mutex_unlock(&t->mutex);
}
else
- /* We take the lock right after entering the loop */
+ /* Lock should be held on entering the loop */
continue;
}
+
if (bo == NULL) {
/*
* If the bo is NULL it means that we've unreferenced in other
* thread - therefore we should expect ENOENT
*/
igt_assert_eq(errno, ENOENT);
- continue;
+ } else {
+ drm_intel_bo_unreference(bo);
}
- drm_intel_bo_unreference(bo);
-
pthread_mutex_lock(&t->mutex);
}
pthread_mutex_unlock(&t->mutex);
--
2.5.0
More information about the Intel-gfx
mailing list