diff options
author | Dmitry Vyukov <dvyukov@google.com> | 2014-03-12 14:55:20 +0000 |
---|---|---|
committer | Dmitry Vyukov <dvyukov@google.com> | 2014-03-12 14:55:20 +0000 |
commit | 76921764abaeb450c20172731367fbcf50135101 (patch) | |
tree | ae14097bcb936279248764dada3dbef40b5bb4ee | |
parent | 5674cfafe94e9ea12894e480282393e6a1b7477f (diff) | |
download | compiler-rt-76921764abaeb450c20172731367fbcf50135101.tar.gz |
tsan: fix deadlock in deadlock detector
forget to unlock a mutex on one of the paths
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@203663 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/sanitizer_common/sanitizer_addrhashmap.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/sanitizer_common/sanitizer_addrhashmap.h b/lib/sanitizer_common/sanitizer_addrhashmap.h index 9bb44e41c..4eb0d406a 100644 --- a/lib/sanitizer_common/sanitizer_addrhashmap.h +++ b/lib/sanitizer_common/sanitizer_addrhashmap.h @@ -157,8 +157,10 @@ typename AddrHashMap<T, kSize>::Cell *AddrHashMap<T, kSize>::acquire(uptr addr, for (;;) { Cell *c = &table_[h]; uptr addr1 = atomic_load(&c->addr, memory_order_acquire); - if (addr1 == addr) // another thread has inserted it ahead of us + if (addr1 == addr) { // another thread has inserted it ahead of us + c0->mtx.Unlock(); return c; + } // Skip kLocked, since we hold the home cell mutex, it can't be our elem. if ((addr1 == 0 || addr1 == kRemoved) && atomic_compare_exchange_strong(&c->addr, &addr1, kLocked, |