]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - nptl/pthread_mutex_getprioceiling.c
malloc: Check for large bin list corruption when inserting unsorted chunk
[thirdparty/glibc.git] / nptl / pthread_mutex_getprioceiling.c
index 54522fc9c3afe091dd4fb989fd4d6781cc6f4098..5a8c06094ab4d86e00d250f90915771e1667cbe2 100644 (file)
@@ -1,5 +1,5 @@
 /* Get current priority ceiling of pthread_mutex_t.
-   Copyright (C) 2006-2016 Free Software Foundation, Inc.
+   Copyright (C) 2006-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 2006.
 
@@ -24,7 +24,9 @@
 int
 pthread_mutex_getprioceiling (const pthread_mutex_t *mutex, int *prioceiling)
 {
-  if (__builtin_expect ((mutex->__data.__kind
+  /* See concurrency notes regarding __kind in struct __pthread_mutex_s
+     in sysdeps/nptl/bits/thread-shared-types.h.  */
+  if (__builtin_expect ((atomic_load_relaxed (&(mutex->__data.__kind))
                         & PTHREAD_MUTEX_PRIO_PROTECT_NP) == 0, 0))
     return EINVAL;