<p>Friendly Automation <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/17741">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Benjamin Keith Ford: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Friendly Automation: Approved for Submit
</div><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>---<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;"><span>diff --git a/main/bridge_channel.c b/main/bridge_channel.c</span><br><span>index 1f401c8..1b0f1dd 100644</span><br><span>--- a/main/bridge_channel.c</span><br><span>+++ b/main/bridge_channel.c</span><br><span>@@ -2861,11 +2861,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>@@ -2875,7 +2877,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>@@ -2883,6 +2884,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><div style="white-space:pre-wrap"></div><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/17741">change 17741</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/+/17741"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-Change-Id: Ib68eb7037e5a479bcc2aceee77337cdde1fbdde6 </div>
<div style="display:none"> Gerrit-Change-Number: 17741 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-Reviewer: Benjamin Keith Ford <bford@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>