From 52fbf19819e911d590da3766898615d6c21027c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Bri=C3=A8re?= Date: Sun, 29 Sep 2019 00:20:23 -0400 Subject: 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 --- src/phone.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- cgit v1.2.3