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 | 22196e777c8f3753d1b71aa053aa038bea7ae16d (patch) | |
| tree | da2254f79fd3cd86360bc04eb4989372d1eb2159 | |
| parent | 07d949f39a3fb8946195ef6068220032b5a81b6b (diff) | |
| download | bcm5719-llvm-22196e777c8f3753d1b71aa053aa038bea7ae16d.tar.gz bcm5719-llvm-22196e777c8f3753d1b71aa053aa038bea7ae16d.zip | |
tsan: fix deadlock in deadlock detector
forget to unlock a mutex on one of the paths
llvm-svn: 203663
| -rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_addrhashmap.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_addrhashmap.h b/compiler-rt/lib/sanitizer_common/sanitizer_addrhashmap.h index 9bb44e41c91..4eb0d406a97 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_addrhashmap.h +++ b/compiler-rt/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, |

