summaryrefslogtreecommitdiff
path: root/tests/drm_import_export.c
diff options
context:
space:
mode:
authorMika Kuoppala <mika.kuoppala@intel.com>2015-11-25 15:00:50 +0200
committerMika Kuoppala <mika.kuoppala@intel.com>2015-11-25 15:52:18 +0200
commit32329b2e7dd9b6b69a397da0356bd1ebc6a45901 (patch)
tree211e12834cb021f0d2b4f0ba06e54ad7be48b393 /tests/drm_import_export.c
parent3b1a55874d151c8044b0168de4b6d9351ced69d4 (diff)
tests/drm_import_export: Always loop with mutex held
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@intel.com> Cc: Thomas Wood <thomas.wood@intel.com> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com> Reviewed-by: Michał Winiarski <michal.winiarski@intel.com>
Diffstat (limited to 'tests/drm_import_export.c')
-rw-r--r--tests/drm_import_export.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/drm_import_export.c b/tests/drm_import_export.c
index 49486ab5..cfe5f6d8 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);