summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorEugene Kosov <claprix@yandex.ru>2019-07-26 12:36:06 +0300
committerEugene Kosov <claprix@yandex.ru>2019-07-26 12:36:06 +0300
commit7db999322c004477df348003d7a00c143078143a (patch)
treeeef33ea9ed8321d70571f21eec36b99e73840e58 /mysys
parent51d58f566af0dea01bc391798e05c7edf53b345f (diff)
downloadmariadb-git-7db999322c004477df348003d7a00c143078143a.tar.gz
MDEV-20183 data race at safe_mutex_lock()
fix is simple: just move mp->file under mp->global protection
Diffstat (limited to 'mysys')
-rw-r--r--mysys/thr_mutex.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mysys/thr_mutex.c b/mysys/thr_mutex.c
index 85d42d4fd0a..568ed3ecb46 100644
--- a/mysys/thr_mutex.c
+++ b/mysys/thr_mutex.c
@@ -237,6 +237,8 @@ int safe_mutex_lock(safe_mutex_t *mp, myf my_flags, const char *file,
int error;
DBUG_PRINT("mutex", ("%s (0x%lx) locking", mp->name ? mp->name : "Null",
(ulong) mp));
+
+ pthread_mutex_lock(&mp->global);
if (!mp->file)
{
fprintf(stderr,
@@ -245,8 +247,6 @@ int safe_mutex_lock(safe_mutex_t *mp, myf my_flags, const char *file,
fflush(stderr);
abort();
}
-
- pthread_mutex_lock(&mp->global);
if (mp->count > 0)
{
/*