[asterisk-dev] [Code Review] Fix deadlock in chan_sip.

Mark Michelson mmichelson at digium.com
Wed Jun 17 15:45:08 CDT 2009



> On 2009-06-17 15:41:51, Mark Michelson wrote:
> > /trunk/channels/chan_sip.c, lines 6048-6054
> > <http://reviewboard.digium.com/r/285/diff/1/?file=5665#file5665line6048>
> >
> >     You could simplify things here by unconditionally unlocking and unreffing the channel after setting the value of codec. None of the rest of this function makes use of the channel.

Well, actually since codec is pointing into the channel structure, you can't unlock and unref the channel until you're done with the codec variable. So, let me edit my first statement a bit.

If you make a copy of the channel variable and set codec equal to it, then you can unconditionally unlock and unref the channel after setting the codec variable.

something like
codec = ast_strdupa(S_OR(pbx_builtin_getvar_helper(p->owner, "SIP_CODEC_OUTBOUND")), "");


- Mark


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.digium.com/r/285/#review862
-----------------------------------------------------------


On 2009-06-17 13:05:05, Matthew Nicholson wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.digium.com/r/285/
> -----------------------------------------------------------
> 
> (Updated 2009-06-17 13:05:05)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> This patch resolves a deadlock in chan_sip caused by the channel pvt getting locked before the channel lock.  This change also fixes a race condition involving a channel variable returned by pbx_builtin_get_var_helper().
> 
> 
> Diffs
> -----
> 
>   /trunk/channels/chan_sip.c 201093 
> 
> Diff: http://reviewboard.digium.com/r/285/diff
> 
> 
> Testing
> -------
> 
> Lightly tested in my lab environment.
> 
> 
> Thanks,
> 
> Matthew
> 
>




More information about the asterisk-dev mailing list