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

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">pbx_ael:  Fix crash and lockup issue regarding 'ael reload'<br><br>Currently pbx_ael does not check if a reload is currently pending<br>before proceeding with a reload. This can cause multiple threads to<br>operate at the same time on what should be mutex protected data. This<br>change adds protection to reloading to ensure only one ael reload is<br>executing at a time.<br><br>ASTERISK-29609 #close<br><br>Change-Id: I5ed392ad226f6e4e7696ad742076d3e45c57af35<br>---<br>M pbx/pbx_ael.c<br>1 file changed, 12 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/pbx/pbx_ael.c b/pbx/pbx_ael.c</span><br><span>index d55f2d4..8bf3af0 100644</span><br><span>--- a/pbx/pbx_ael.c</span><br><span>+++ b/pbx/pbx_ael.c</span><br><span>@@ -245,7 +245,13 @@</span><br><span>   if (a->argc != 2)</span><br><span>                 return CLI_SHOWUSAGE;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+#ifndef STANDALONE</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Lock-Protected reload.  It is VERY BAD to have simultaneous ael load_module() executing at the same time */</span><br><span style="color: hsl(120, 100%, 40%);">+        return ast_module_reload("pbx_ael") == AST_MODULE_RELOAD_SUCCESS ? CLI_SUCCESS : CLI_FAILURE;</span><br><span style="color: hsl(120, 100%, 40%);">+#else</span><br><span style="color: hsl(120, 100%, 40%);">+        /* Lock-Protected reload not needed (and not available) when running standalone (Example: via aelparse cli tool).  No reload contention is possible */</span><br><span>       return (pbx_load_module() ? CLI_FAILURE : CLI_SUCCESS);</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span> }</span><br><span> </span><br><span> static struct ast_cli_entry cli_ael[] = {</span><br><span>@@ -274,7 +280,13 @@</span><br><span> </span><br><span> static int reload(void)</span><br><span> {</span><br><span style="color: hsl(120, 100%, 40%);">+#ifndef STANDALONE</span><br><span style="color: hsl(120, 100%, 40%);">+  /* Lock-Protected reload.  It is VERY BAD to have simultaneous ael pbx_load_module() executing at the same time */</span><br><span style="color: hsl(120, 100%, 40%);">+    return ast_module_reload("pbx_ael") == AST_MODULE_RELOAD_SUCCESS ? AST_MODULE_LOAD_SUCCESS : AST_MODULE_LOAD_DECLINE;</span><br><span style="color: hsl(120, 100%, 40%);">+#else</span><br><span style="color: hsl(120, 100%, 40%);">+        /* Lock-Protected reload not needed (and not available) when running standalone (Example: via aelparse cli tool).  No reload contention is possible */</span><br><span>       return pbx_load_module();</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span> }</span><br><span> </span><br><span> #ifdef STANDALONE</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/+/16356">change 16356</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/+/16356"/><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: I5ed392ad226f6e4e7696ad742076d3e45c57af35 </div>
<div style="display:none"> Gerrit-Change-Number: 16356 </div>
<div style="display:none"> Gerrit-PatchSet: 4 </div>
<div style="display:none"> Gerrit-Owner: Mark Murawski <markm@intellasoft.net> </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: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Sean Bright <sean@seanbright.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>