From: Jeff Peeler Date: Fri, 18 Jun 2010 18:33:17 +0000 (+0000) Subject: Eliminate deadlock potential in dahdi_fixup(). X-Git-Tag: 1.4.34-rc1~2^2~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5cf7c69afb6114574d8ed8fc69b652f83f79ddf8;p=thirdparty%2Fasterisk.git Eliminate deadlock potential in dahdi_fixup(). (This is a backport of 269307, committed to trunk by rmudgett.) Calling dahdi_indicate() when the channel private lock is already held can cause a deadlock if the PRI lock is needed because dahdi_indicate() will also get the channel private lock. The pri_grab() function assumes that the channel private lock is held once to avoid deadlock. (closes issue #17261) Reported by: aragon git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@271335 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c index d54c951dfd..9cd089a93d 100644 --- a/channels/chan_dahdi.c +++ b/channels/chan_dahdi.c @@ -3938,10 +3938,10 @@ static int dahdi_fixup(struct ast_channel *oldchan, struct ast_channel *newchan) dahdi_unlink(NULL, p, 0); p->subs[x].owner = newchan; } - if (newchan->_state == AST_STATE_RINGING) - dahdi_indicate(newchan, AST_CONTROL_RINGING, NULL, 0); update_conf(p); ast_mutex_unlock(&p->lock); + if (newchan->_state == AST_STATE_RINGING) + dahdi_indicate(newchan, AST_CONTROL_RINGING, NULL, 0); return 0; }