]> git.ipfire.org Git - thirdparty/asterisk.git/commit
res_pjsip_pubsub: Remove serializer when sending final NOTIFY. 09/1509/1
authorMark Michelson <mmichelson@digium.com>
Thu, 17 Sep 2015 22:28:30 +0000 (17:28 -0500)
committerRichard Mudgett <rmudgett@digium.com>
Thu, 22 Oct 2015 21:18:58 +0000 (16:18 -0500)
commit7fc9a998b12057ba0725d5d8af8d3abf206ca1d6
tree7d5eff7c8959da046dbddc570370b32d124ca540
parent7a47ab77c1148865f9f512c1703cdef1414ec48e
res_pjsip_pubsub: Remove serializer when sending final NOTIFY.

There have been crashes seen where a taskprocessor's listener is NULL
unexpectedly.

Looking at backtraces, the problem was specifically seen in PJSIP
serializers.

Subscriptions make the mistake of removing a serializer from a dialog
during subscription tree destruction. Since subscription trees are
reference-counted, guaranteeing the circumstances behind the destruction
are not possible. This makes it so that the dialog serializer can be
removed while not holding the dialog lock. This makes it possible for
the distributor to get a pointer to the dialog serializer and have that
serializer get freed out from under it.

The fix for this is to remove the serializer from a subscription dialog
when sending the final NOTIFY. This guarantees that the serializer is
removed with the dialog lock held. By doing this, we guarantee that if
the distributor gains access to the dialog's serializer, it will not be
possible for the serializer to get freed by another thread.

Change-Id: I21f5dac33529f65cec45679bdace60670800ff66
res/res_pjsip_pubsub.c