<p>Joshua Colp <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/15652">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  George Joseph: Looks good to me, approved
  Joshua Colp: Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">core_unreal: Fix deadlock with T.38 control frames.<br><br>When using the ast_unreal_lock_all function no channel<br>locks can be held before calling it.<br><br>This change unlocks the channel that indicate was<br>called on before doing so and then relocks it afterwards.<br><br>ASTERISK-29035<br><br>Change-Id: Id65016201b5f9c9519a216e250f9101c629e19e9<br>---<br>M main/core_unreal.c<br>1 file changed, 4 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/main/core_unreal.c b/main/core_unreal.c</span><br><span>index 5adc90d..a79fca4 100644</span><br><span>--- a/main/core_unreal.c</span><br><span>+++ b/main/core_unreal.c</span><br><span>@@ -710,6 +710,7 @@</span><br><span>                         * signaling and we need to be sure that the locking order is the same to prevent possible</span><br><span>                    * deadlocks.</span><br><span>                         */</span><br><span style="color: hsl(120, 100%, 40%);">+                   ast_channel_unlock(ast);</span><br><span>                     ast_unreal_lock_all(p, &chan, &owner);</span><br><span> </span><br><span>                   if (owner) {</span><br><span>@@ -726,12 +727,14 @@</span><br><span>                         }</span><br><span> </span><br><span>                        ao2_unlock(p);</span><br><span style="color: hsl(120, 100%, 40%);">+                        ast_channel_lock(ast);</span><br><span>               } else if (parameters->request_response == AST_T38_TERMINATED) {</span><br><span>                  /*</span><br><span>                    * Lock both parts of the local channel so we can restore their topologies to the original.</span><br><span>                   * The topology should be on the unreal_pvt structure, with a ref that we can steal. Same</span><br><span>                     * conditions as above.</span><br><span>                       */</span><br><span style="color: hsl(120, 100%, 40%);">+                   ast_channel_unlock(ast);</span><br><span>                     ast_unreal_lock_all(p, &chan, &owner);</span><br><span> </span><br><span>                   if (owner) {</span><br><span>@@ -745,6 +748,7 @@</span><br><span>                   }</span><br><span> </span><br><span>                        ao2_unlock(p);</span><br><span style="color: hsl(120, 100%, 40%);">+                        ast_channel_lock(ast);</span><br><span>               }</span><br><span> </span><br><span>                /*</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/15652">change 15652</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/+/15652"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 18.3 </div>
<div style="display:none"> Gerrit-Change-Id: Id65016201b5f9c9519a216e250f9101c629e19e9 </div>
<div style="display:none"> Gerrit-Change-Number: 15652 </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-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>