[asterisk-dev] [Code Review] 2834: res_pjsip: Fix crash when configuration system fails

Matt Jordan reviewboard at asterisk.org
Tue Sep 10 07:48:38 CDT 2013


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

(Updated Sept. 10, 2013, 12:48 p.m.)


Status
------

This change has been discarded.


Review request for Asterisk Developers.


Repository: Asterisk


Description
-------

While playing around with Asterisk, I managed to tell it to load res_pjsip and friends with no sorcery wizards loaded. This resulted in the following crash:

Thread 1 (Thread 0x7f1af1ada760 (LWP 6119)):
#0  ast_threadpool_push (pool=0x0, task=0x7f1aba1d0880 <sync_task>, data=0x7fff1e4157a0)
    at threadpool.c:896
#1  0x00007f1aba1d2aec in ast_sip_push_task_synchronous (serializer=0x0, 
    sip_task=0x7f1aba1d0f70 <unregister_service>, task_data=0x7fff1e415858) at res_pjsip.c:1694
#2  0x00007f1aba1d2b7c in ast_sip_unregister_service (module=0x7f1aba3e4180) at res_pjsip.c:1050
#3  0x00007f1aba1d7820 in ast_sip_destroy_distributor () at res_pjsip/pjsip_distributor.c:368
#4  0x00007f1aba1d0c7a in load_module () at res_pjsip.c:1886
#5  load_module () at res_pjsip.c:1803
#6  0x000000000051420f in start_resource (mod=0x1771800) at loader.c:971
#7  0x0000000000514a5a in start_resource (mod=<optimized out>) at loader.c:964
#8  load_resource_list (load_order=0x7fff1e415a80, global_symbols=1, mod_count=0x7fff1e415a9c)
    at loader.c:1174
#9  0x000000000051661a in load_modules (preload_only=<optimized out>) at loader.c:1322
#10 0x000000000042ffdd in main (argc=<optimized out>, argv=<optimized out>) at asterisk.c:4431

Basically, since sorcery can't load the configuration, you jump to the error: label and call ast_sip_destroy_distributor with no threadpool allocated. Kerblooey.

This patch checks for this in ast_sip_unregister_service, which feels like the most appropriate place as you shouldn't push a task to unregister a service if you don't have a serializer/threadpool. I'm open to other suggestions on where to catch this however.


Diffs
-----

  /branches/12/res/res_pjsip.c 398627 

Diff: https://reviewboard.asterisk.org/r/2834/diff/


Testing
-------


Thanks,

Matt Jordan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130910/0af85590/attachment.htm>


More information about the asterisk-dev mailing list