[asterisk-dev] [Code Review] Channel initialization failure causes crashes.

Russell Bryant russell at digium.com
Fri May 21 15:42:00 CDT 2010


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/675/#review2065
-----------------------------------------------------------

Ship it!


- Russell


On 2010-05-21 14:02:41, rmudgett wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/675/
> -----------------------------------------------------------
> 
> (Updated 2010-05-21 14:02:41)
> 
> 
> Review request for Asterisk Developers, Russell Bryant and Mark Michelson.
> 
> 
> Summary
> -------
> 
> __ast_channel_alloc_ap() has several points in the initialization of a new channel structure where it could fail.  Since the channel structure is now an ao2 object, the destructor callback needs to be able to handle clean up when the structure setup is incomplete.
> 
> Problems corrected:
> 1) Failing to setup the alertpipe would not unreference the structure but free it directly.  Doing this to an ao2_object is very bad.
> 2) File descriptors need to be initialized to -1 before a construction failure could occur so the destructor will not close unopened descriptors.
> 3) The destructor needs to check that the string field has been initialized before using any string field values.  Crashes expected.
> 4) The destructor should not notify devstate if the device name is empty.  It is a waste of cycles and a couple ERROR log messages are generated.
> 
> 
> Diffs
> -----
> 
>   /trunk/main/channel.c 265082 
> 
> Diff: https://reviewboard.asterisk.org/r/675/diff
> 
> 
> Testing
> -------
> 
> Forced __ast_channel_alloc_ap() to fail at each initialization failure location.  No detected bad things happened besides the expected call not going through.
> 
> 
> Thanks,
> 
> rmudgett
> 
>




More information about the asterisk-dev mailing list