mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-13 00:04:53 +00:00
CHANNEL(peer), chan_iax2, res_fax, SNMP agent: Fix deadlock from reaching across a bridge.
Calling ast_channel_bridge_peer() cannot be done while holding any channel locks. The reported issue hit the deadlock in chan_iax2, but an audit of the ast_channel_bridge_peer() calls found three more locations where the same deadlock can occur. * Made CHANNEL(peer), res_fax, and the SNMP agent not call ast_channel_bridge_peer() with any channel locked. For CHANNEL(peer) I had to rework the logic to not hold the channel lock. * Made chan_iax2 no longer call ast_channel_bridge_peer(). It was done for legacy reasons that no longer apply. * Removed the iax.conf forcejitterbuffer option. It is now always enabled when the jitterbuffer option is enabled. If you put a jitter buffer on a channel it will be on the channel. ASTERISK-24600 #close Reported by: Jeff Collell Review: https://reviewboard.asterisk.org/r/4342/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@430817 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -2888,6 +2888,7 @@ static struct fax_gateway *fax_gateway_new(struct ast_channel *chan, struct ast_
|
||||
static int fax_gateway_start(struct fax_gateway *gateway, struct ast_fax_session_details *details, struct ast_channel *chan)
|
||||
{
|
||||
struct ast_fax_session *s;
|
||||
int start_res;
|
||||
|
||||
/* create the FAX session */
|
||||
if (!(s = fax_session_new(details, chan, gateway->s, gateway->token))) {
|
||||
@@ -2908,7 +2909,10 @@ static int fax_gateway_start(struct fax_gateway *gateway, struct ast_fax_session
|
||||
gateway->s = s;
|
||||
gateway->token = NULL;
|
||||
|
||||
if (gateway->s->tech->start_session(gateway->s) < 0) {
|
||||
ast_channel_unlock(chan);
|
||||
start_res = gateway->s->tech->start_session(gateway->s);
|
||||
ast_channel_lock(chan);
|
||||
if (start_res < 0) {
|
||||
ast_string_field_set(details, result, "FAILED");
|
||||
ast_string_field_set(details, resultstr, "error starting gateway session");
|
||||
ast_string_field_set(details, error, "INIT_ERROR");
|
||||
|
@@ -298,12 +298,18 @@ static u_char *ast_var_channels_table(struct variable *vp, oid *name, size_t *le
|
||||
}
|
||||
break;
|
||||
case ASTCHANBRIDGE:
|
||||
if ((bridge = ast_channel_bridge_peer(chan)) != NULL) {
|
||||
ast_channel_unlock(chan);
|
||||
bridge = ast_channel_bridge_peer(chan);
|
||||
if (bridge) {
|
||||
ast_channel_lock(bridge);
|
||||
ast_copy_string(string_ret, ast_channel_name(bridge), sizeof(string_ret));
|
||||
ast_channel_unlock(bridge);
|
||||
ast_channel_unref(bridge);
|
||||
|
||||
*var_len = strlen(string_ret);
|
||||
ret = (u_char *)string_ret;
|
||||
ast_channel_unref(bridge);
|
||||
}
|
||||
ast_channel_lock(chan);
|
||||
break;
|
||||
case ASTCHANMASQ:
|
||||
if (ast_channel_masq(chan) && !ast_strlen_zero(ast_channel_name(ast_channel_masq(chan)))) {
|
||||
|
Reference in New Issue
Block a user