<p>Joshua Colp has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/17852">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">bridge: Unlock channel during Local peer check.<br><br>It's not safe to keep the channel locked while locking<br>the peer Local channel, as it can result in a deadlock.<br><br>This change unlocks it during this time but keeps the<br>bridge locked to ensure nothing changes about the bridge.<br><br>ASTERISK-29821<br><br>Change-Id: Ib68eb7037e5a479bcc2aceee77337cdde1fbdde6<br>(cherry picked from commit d83a46869ed5e13d0ed5a898bac8faed61d91203)<br>---<br>M main/bridge_channel.c<br>1 file changed, 5 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/52/17852/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/main/bridge_channel.c b/main/bridge_channel.c</span><br><span>index aefb764..c804cb1 100644</span><br><span>--- a/main/bridge_channel.c</span><br><span>+++ b/main/bridge_channel.c</span><br><span>@@ -2877,11 +2877,13 @@</span><br><span>        ast_bridge_lock(bridge_channel->bridge);</span><br><span> </span><br><span>      ast_channel_lock(bridge_channel->chan);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span>   peer = ast_local_get_peer(bridge_channel->chan);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>        if (peer) {</span><br><span>          struct ast_bridge *peer_bridge;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+           ast_channel_unlock(bridge_channel->chan);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>               ast_channel_lock(peer);</span><br><span>              peer_bridge = ast_channel_internal_bridge(peer);</span><br><span>             ast_channel_unlock(peer);</span><br><span>@@ -2891,7 +2893,6 @@</span><br><span>             * to be reference counted or locked.</span><br><span>                 */</span><br><span>          if (peer_bridge == bridge_channel->bridge) {</span><br><span style="color: hsl(0, 100%, 40%);">-                 ast_channel_unlock(bridge_channel->chan);</span><br><span>                         ast_bridge_unlock(bridge_channel->bridge);</span><br><span>                        ast_debug(1, "Bridge %s: %p(%s) denying Bridge join to prevent Local channel loop\n",</span><br><span>                              bridge_channel->bridge->uniqueid,</span><br><span>@@ -2899,6 +2900,8 @@</span><br><span>                              ast_channel_name(bridge_channel->chan));</span><br><span>                  return -1;</span><br><span>           }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+           ast_channel_lock(bridge_channel->chan);</span><br><span>   }</span><br><span> </span><br><span>        bridge_channel->read_format = ao2_bump(ast_channel_readformat(bridge_channel->chan));</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/17852">change 17852</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/17852"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: certified/18.9 </div>
<div style="display:none"> Gerrit-Change-Id: Ib68eb7037e5a479bcc2aceee77337cdde1fbdde6 </div>
<div style="display:none"> Gerrit-Change-Number: 17852 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>