[asterisk-dev] [Code Review] Prevent segfault when asterisk restarts. Happens if call arrives before fully booted.

rmudgett reviewboard at asterisk.org
Fri Sep 2 14:23:01 CDT 2011


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



trunk/main/pbx.c
<https://reviewboard.asterisk.org/r/1407/#comment8251>

    I think this needs to be done for both error return points here:
    	if (!args || !args->no_hangup_chan) {
    		ast_hangup(c);
    	}
    
    Also returning non-zero for either error exit point is not very safe as far as what happens to c.  Does it or does it not get hung up?  Many callers or callers of the wrapper functions like ast_pbx_run_args() never check the return value of the function.  Therefore if the PBX fails to run for whatever reason (Not booted, calloc failure, or call limit exceeded) the status of c is in doubt.
    
    You seem to have found a can of worms here. :)


- rmudgett


On Sept. 2, 2011, 4:49 a.m., Alec Davis wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1407/
> -----------------------------------------------------------
> 
> (Updated Sept. 2, 2011, 4:49 a.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> If a call arrives before asterisk is fully booted generally it will segfault.
> 
> 
> Diffs
> -----
> 
>   trunk/main/pbx.c 333893 
> 
> Diff: https://reviewboard.asterisk.org/r/1407/diff
> 
> 
> Testing
> -------
> 
> restarted asterisk, and before all modules have finished loading made a call into it.
> Warnign message appears, and call is dropped.
> No orpaned channels.
> 
> 
> Thanks,
> 
> Alec
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20110902/02e754bc/attachment.htm>


More information about the asterisk-dev mailing list