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

Matthew Nicholson mnicholson at digium.com
Wed Jun 17 15:48:52 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.
> 
>  wrote:
>     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")), "");

This makes sense, that way the channel lock wouldn't be held as long.


- Matthew


-----------------------------------------------------------
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