]> 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:24 +0000 (07:20 -0600)
commitee7d72eb72f3a7fc9864e47c3264a353af4a80c8
treecc6064dca4988044f74927749714c72ab3cc0fc0
parentcee68ea4f2370d4a9228941f46a925e13b42846a
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