]> git.ipfire.org Git - thirdparty/asterisk.git/commit
chan_pjsip: Lock channel when checking for RTP changes. 04/3004/1
authorMark Michelson <mmichelson@digium.com>
Thu, 9 Jun 2016 15:37:53 +0000 (10:37 -0500)
committerMark Michelson <mmichelson@digium.com>
Thu, 9 Jun 2016 15:43:46 +0000 (10:43 -0500)
commitcdb7edbe7b3f4fdedf999b03c2073ca15c326c31
tree961a9901119f5fc4bce16a09acd17720c5b2c261
parentfbece11a0c3b6bf7610f3523a6876a065c595ffc
chan_pjsip: Lock channel when checking for RTP changes.

bridge_native_rtp can call into an RTP-capable channel driver in order
for the driver to update information about who the channel is
communicating with. For SIP channel drivers, this means deactivating
RTCP and sending a reinvite so that the endpoints can communicate
directly.

bridge_native_rtp does the right thing and has the channel locked when
calling into the channel driver. chan_pjsip can't alter session
properties in this thread, though. chan_pjsip queues a task on the
session serializer in order to update properties there.

The problem is that this queued task was not locking the channel. This
meant that the queued task could attempt to deactivate RTCP at the same
time that the channel thread was attempting to process an incoming RTCP
packet. This could lead to a crash.

This patch fixes the issue by locking the channel in the queued task
when altering RTP properties.

ASTERISK-26092 #close
Reported by Niklas Larsson

Change-Id: I3464e226a3c41f6b915f97891e07fa1599e2a159
channels/chan_pjsip.c