From: Richard Mudgett Date: Fri, 14 Jan 2011 21:09:57 +0000 (+0000) Subject: Deadlock between dahdi_request() and pri_dchannel() processing an incomming call. X-Git-Tag: 1.8.3-rc1~3^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=78e1319a1351f61b6986b5e45a08af21433dd53f;p=thirdparty%2Fasterisk.git Deadlock between dahdi_request() and pri_dchannel() processing an incomming call. The sig_pri_new_ast_channel() is called with the channel private lock held when pri_dchannel() calls it and no channel private lock held when dahdi_request() calls it. The use of pri_grab() in sig_pri_new_ast_channel() could leave the channel private lock held when it returns if the lock was not held before calling it. Make sig_pri_new_ast_channel() just lock the PRI span lock instead of using pri_grab(). It is safe to do this because dahdi_request() does not have the channel private lock and the deadlock potential with the PRI span lock is only between pri_dchannel() and other threads. git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@301946 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/sig_pri.c b/channels/sig_pri.c index f6c6b07960..255f0ff356 100644 --- a/channels/sig_pri.c +++ b/channels/sig_pri.c @@ -880,11 +880,10 @@ static struct ast_channel *sig_pri_new_ast_channel(struct sig_pri_chan *p, int s if (transfercapability & AST_TRANS_CAP_DIGITAL) { sig_pri_set_digital(p, 1); } - if (p->pri && !pri_grab(p, p->pri)) { + if (p->pri) { + ast_mutex_lock(&p->pri->lock); sig_pri_span_devstate_changed(p->pri); - pri_rel(p->pri); - } else { - ast_log(LOG_WARNING, "Failed to grab PRI!\n"); + ast_mutex_unlock(&p->pri->lock); } return c;