]> git.ipfire.org Git - thirdparty/asterisk.git/commit
Better way to get chan and pvt lock for issue ASTERISK-17431.
authorRichard Mudgett <rmudgett@digium.com>
Fri, 1 Jul 2011 21:07:22 +0000 (21:07 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Fri, 1 Jul 2011 21:07:22 +0000 (21:07 +0000)
commit6348add6645975baf2610a7afb9994d79fc0603c
treedc56cba83d03bda9881fc6310c3efe2307757caa
parentcf8b27cd398d63a4722de2698919fe41633caa01
Better way to get chan and pvt lock for issue ASTERISK-17431.

Redoes -r308945 for issue ASTERISK-17431 deadlock fix for
sip_set_udptl_peer() and sip_set_rtp_peer().

* Lock the channels in the defined order and avoid the need for a deadlock
avoidance loop.

* Lock the channel before getting the pointer to the private structure to
be sure that the pointer will not change due to a masquerade or channel
hangup.

* To preserve sanity, check that chan and p->owner are the same.  (Pointer
rearangements should not happen without the protection of locks because
bad things tend to happen otherwise.)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@326144 65c4cc65-6c06-0410-ace0-fbb531ad65f3
channels/chan_sip.c