]> git.ipfire.org Git - thirdparty/asterisk.git/commit
sig_pri: Fix deadlock caused by sig_pri_queue_hangup
authorGeorge Joseph <gjoseph@digium.com>
Mon, 30 Dec 2019 17:04:23 +0000 (10:04 -0700)
committerGeorge Joseph <gjoseph@digium.com>
Tue, 7 Jan 2020 13:20:07 +0000 (07:20 -0600)
commit015cdc9f64ffa8545376b96ced8704ebfc585ad3
tree1ebbc47d495eb7bb1cc32824af1795a5d614dbd1
parente5446d7ffcdee34e106524e9b6647d6ba1e0e8ca
sig_pri:  Fix deadlock caused by sig_pri_queue_hangup

The change to add setting hangupsource to sig_pri_queue_hangup()
made in https://gerrit.asterisk.org/c/asterisk/+/12857 casued
deadlocks when a hangup request was received from the core at the
same time a hanguprequest was received from the remote end via the
D channel.

Although the PRI's channel private structure was being unlocked
before setting the hangupsource, the PRI's own lock was still being
held during the process.  If channel actions were also coming from
the core, a deadlock on the PRI could result.  This deadlock could
then escalate to the entire DAHDI subsystem via DAHDI's global
interface list lock, especially if someone used the PRI CLI commands.

Fix:

* We now unlock the PRI as well as the PRI's channel private
  structure before setting the hangupsource, then relock both
  afterwards.

ASTERISK-28605
Reported by: Dirk Wendland

Change-Id: Id74aaa5d4e3746063dbe9deed188eb65193cb9c9
channels/sig_pri.c