Eliminate deadlock potential in dahdi_fixup().

Calling dahdi_indicate() within dahdi_fixup() while the owner pointers are
in a potentially inconsistent state is a potentially bad thing in
principle.

However, 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.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@269307 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Richard Mudgett
2010-06-09 16:54:38 +00:00
parent e98835e437
commit 6c6260d4c7

View File

@@ -7085,9 +7085,6 @@ 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);
if (analog_lib_handles(p->sig, p->radio, p->oprmode)) {
analog_fixup(oldchan, newchan, p->sig_pvt);
}
@@ -7099,6 +7096,10 @@ static int dahdi_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
update_conf(p);
ast_mutex_unlock(&p->lock);
if (newchan->_state == AST_STATE_RINGING) {
dahdi_indicate(newchan, AST_CONTROL_RINGING, NULL, 0);
}
return 0;
}