Merged revisions 326144 via svnmerge from
authorRichard Mudgett <rmudgett@digium.com>
Fri, 1 Jul 2011 21:11:34 +0000 (21:11 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Fri, 1 Jul 2011 21:11:34 +0000 (21:11 +0000)
commit76e4e2e7772ceae388a98aad3e67fdb45483ee40
treefd21aa2acc4bd7e6cf2db95ddbce7bed26f40316
parent4dc095755541284d3a559a640eab6fd7fe2ca975
Merged revisions 326144 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r326144 | rmudgett | 2011-07-01 16:07:22 -0500 (Fri, 01 Jul 2011) | 16 lines

  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/trunk@326145 65c4cc65-6c06-0410-ace0-fbb531ad65f3
channels/chan_sip.c