]> git.ipfire.org Git - thirdparty/asterisk.git/commit
res_pjsip_session: segfault on already disconnected session 32/3832/1
authorAlexei Gradinari <alex2grad@gmail.com>
Thu, 18 Aug 2016 19:45:59 +0000 (15:45 -0400)
committerAlexei Gradinari <alex2grad@gmail.com>
Tue, 6 Sep 2016 13:58:05 +0000 (08:58 -0500)
commit09e9dca0c5763cae666b8f5a64aa75f661792f29
tree5b20f2971288efbd97f30fba74092c5bf46e6a77
parentf33ccbdf86e8057b53801923b21adf76a396ab79
res_pjsip_session: segfault on already disconnected session

On heavy loaded system the TCP/TLS incoming calls could be
disconnected by pjproject while these calls are being
processed by asterisk which could use the session's memory pools.
If the session in the disconnected state then the session memory
pools were already freed, so we get segfault.

This patch adds a lifetime control on an INVITE session to pjproject.
The lifetime of the session is manipulated by calling
pjsip_inv_add_ref/pjsip_inv_dec_ref.
This patch uses these functions to inform pjproject that the
session is in use.

This patch adds check if the session state is not disconnected
and also checks if the memory pool is not NULL.

This patch also places tasks 'session_end' and 'session_end_completion'
into session's serializer to avoid race condition.

ASTERISK-26291 #close

Change-Id: I4d28b1fb3b91f0492a911d110049d670fdc3c8d7
configure
configure.ac
include/asterisk/autoconfig.h.in
res/res_pjsip_session.c
third-party/pjproject/configure.m4
third-party/pjproject/patches/0002-r5435-add-pjsip_inv_session-ref_cnt.patch [new file with mode: 0644]