]> git.ipfire.org Git - thirdparty/asterisk.git/commit
chan_sip: Fix segfault during module unload 96/4496/1
authorMichael Kuron <m.kuron@gmx.de>
Sat, 26 Nov 2016 16:57:03 +0000 (17:57 +0100)
committerMichael Kuron <m.kuron@gmx.de>
Sat, 26 Nov 2016 17:20:06 +0000 (18:20 +0100)
commit0b588778c0d2400e53e7dff6a3a270579acd51d6
tree83414bb2d4f5b14e6200962b13454833e3fcdbdb
parentd9b24cce0add96061a0b1e0f135b3148789af5ac
chan_sip: Fix segfault during module unload

If a TCP/TLS connection was pending (not accepted and not timed out) during
unload of chan_sip, Asterisk would segfault when trying to send a signal to
a thread whose thread ID hadn't been recorded yet. This commit fixes that by
recording the thread ID before calling the blocking connect() syscall.
This was a regression introduced by 776a14386a55b5425c7e9617eff8af8b45427144.

The above wasn't enough to fix the segfault, which was now delayed to the
point where connect() timed out. Therefore, it was necessary to also remove
the SA_RESTART flag from the SIGURG sigaction so that pthread_kill() could be
used to interruput the connect() syscall.
This was a regression introduced by 5d313f51b982a18f7321adcf7c7a4e822d8b2714.

ASTERISK-26586 #close

Change-Id: I76fd9d47d56e4264e2629bce8ec15fecba673e7b
channels/chan_sip.c
main/asterisk.c