<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
    <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="https://reviewboard.asterisk.org/r/3067/">https://reviewboard.asterisk.org/r/3067/</a>
     </td>
    </tr>
   </table>
   <br />





 <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">My only other thought is that we really should limit this change to 12.

While theoretically this can occur in Asterisk 1.8/11, making this change effectively breaks every other channel driver that isn't in the Asterisk source tree. We should probably avoid doing that in a released branch. It's also highly unlikely to occur in almost every system out there - we ran into it only through some seriously aggressive use of channel redirect.

We should also probably put a \since 12.0.0 before the \note you've added that the channel is returned locked.</pre>
 <br />









<p>- Matt Jordan</p>


<br />
<p>On December 12th, 2013, 11:43 a.m. CST, Joshua Colp wrote:</p>








<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
 <tr>
  <td>

<div>Review request for Asterisk Developers.</div>
<div>By Joshua Colp.</div>


<p style="color: grey;"><i>Updated Dec. 12, 2013, 11:43 a.m.</i></p>









<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
Asterisk
</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Currently when allocating a channel it is possible for external entities to become aware of the channel and try to interact with it before it is completely set up. This occurs because the channel is returned unlocked, and the caller allocating it is then expected to lock, populate it, and unlock. This leaves a small window where something else can get the channel.

The attached change makes it so ast_channel_alloc returns the allocated channel locked. It is expected that the caller then populates and unlocks. This leaves no window for something external to get and use it.</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Placed calls, ran tests, all work as expected.</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>/branches/12/tests/test_voicemail_api.c <span style="color: grey">(403703)</span></li>

 <li>/branches/12/tests/test_substitution.c <span style="color: grey">(403703)</span></li>

 <li>/branches/12/tests/test_stasis_channels.c <span style="color: grey">(403703)</span></li>

 <li>/branches/12/tests/test_cel.c <span style="color: grey">(403703)</span></li>

 <li>/branches/12/tests/test_cdr.c <span style="color: grey">(403703)</span></li>

 <li>/branches/12/tests/test_app.c <span style="color: grey">(403703)</span></li>

 <li>/branches/12/res/res_stasis_snoop.c <span style="color: grey">(403703)</span></li>

 <li>/branches/12/res/res_calendar.c <span style="color: grey">(403703)</span></li>

 <li>/branches/12/res/parking/parking_tests.c <span style="color: grey">(403703)</span></li>

 <li>/branches/12/main/pbx.c <span style="color: grey">(403703)</span></li>

 <li>/branches/12/main/message.c <span style="color: grey">(403703)</span></li>

 <li>/branches/12/main/core_unreal.c <span style="color: grey">(403703)</span></li>

 <li>/branches/12/main/channel.c <span style="color: grey">(403703)</span></li>

 <li>/branches/12/include/asterisk/channel.h <span style="color: grey">(403703)</span></li>

 <li>/branches/12/channels/chan_vpb.cc <span style="color: grey">(403703)</span></li>

 <li>/branches/12/channels/chan_unistim.c <span style="color: grey">(403703)</span></li>

 <li>/branches/12/channels/chan_skinny.c <span style="color: grey">(403703)</span></li>

 <li>/branches/12/channels/chan_sip.c <span style="color: grey">(403703)</span></li>

 <li>/branches/12/channels/chan_pjsip.c <span style="color: grey">(403703)</span></li>

 <li>/branches/12/channels/chan_phone.c <span style="color: grey">(403703)</span></li>

 <li>/branches/12/channels/chan_oss.c <span style="color: grey">(403703)</span></li>

 <li>/branches/12/channels/chan_nbs.c <span style="color: grey">(403703)</span></li>

 <li>/branches/12/channels/chan_multicast_rtp.c <span style="color: grey">(403703)</span></li>

 <li>/branches/12/channels/chan_motif.c <span style="color: grey">(403703)</span></li>

 <li>/branches/12/channels/chan_misdn.c <span style="color: grey">(403703)</span></li>

 <li>/branches/12/channels/chan_mgcp.c <span style="color: grey">(403703)</span></li>

 <li>/branches/12/channels/chan_jingle.c <span style="color: grey">(403703)</span></li>

 <li>/branches/12/channels/chan_iax2.c <span style="color: grey">(403703)</span></li>

 <li>/branches/12/channels/chan_h323.c <span style="color: grey">(403703)</span></li>

 <li>/branches/12/channels/chan_gtalk.c <span style="color: grey">(403703)</span></li>

 <li>/branches/12/channels/chan_dahdi.c <span style="color: grey">(403703)</span></li>

 <li>/branches/12/channels/chan_console.c <span style="color: grey">(403703)</span></li>

 <li>/branches/12/channels/chan_alsa.c <span style="color: grey">(403703)</span></li>

 <li>/branches/12/apps/confbridge/conf_chan_record.c <span style="color: grey">(403703)</span></li>

 <li>/branches/12/apps/app_voicemail.c <span style="color: grey">(403703)</span></li>

 <li>/branches/12/apps/app_meetme.c <span style="color: grey">(403703)</span></li>

 <li>/branches/12/addons/chan_ooh323.c <span style="color: grey">(403703)</span></li>

 <li>/branches/12/addons/chan_mobile.c <span style="color: grey">(403703)</span></li>

</ul>

<p><a href="https://reviewboard.asterisk.org/r/3067/diff/" style="margin-left: 3em;">View Diff</a></p>







  </td>
 </tr>
</table>








  </div>
 </body>
</html>