summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Brière <fbriere@fbriere.net>2019-09-29 00:20:23 -0400
committerFrédéric Brière <fbriere@fbriere.net>2019-12-27 02:28:12 -0500
commit52fbf19819e911d590da3766898615d6c21027c8 (patch)
treeb9523b0f1e86d4410a94886928c3fe1d44706d74
parent21ad823ba038f28a58f0f660cc7ebe902dd459b8 (diff)
downloadtwinkle-52fbf19819e911d590da3766898615d6c21027c8.tar
twinkle-52fbf19819e911d590da3766898615d6c21027c8.tar.gz
twinkle-52fbf19819e911d590da3766898615d6c21027c8.tar.lz
twinkle-52fbf19819e911d590da3766898615d6c21027c8.tar.xz
twinkle-52fbf19819e911d590da3766898615d6c21027c8.zip
Fix "NOTIFY received when line is idle" deadlock
This can easily be triggered by starting a blind transfer, and hanging up before the other end has accepted/rejected it, due to the following path: - recvd_notify() acquires a read lock on lines_mtx - cleanup_dead_lines() is called - A write lock on lines_mtx is acquired
-rw-r--r--src/phone.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/phone.cpp b/src/phone.cpp
index a609bef..c4e515f 100644
--- a/src/phone.cpp
+++ b/src/phone.cpp
@@ -1704,7 +1704,7 @@ void t_phone::recvd_notify(t_request *r, t_tid tid) {
}
// REFER notification
- t_rwmutex_reader x(lines_mtx);
+ t_rwmutex_future_writer x(lines_mtx);
for (unsigned short i = 0; i < lines.size(); i++) {
if (lines[i]->match(r)) {
lines[i]->recvd_notify(r, tid);