[asterisk-bugs] [Asterisk 0018558]: [patch] p->chan can disappear between test and lock in deadlock avoidance in local_hangup

Asterisk Bug Tracker noreply at bugs.digium.com
Fri May 6 16:18:38 CDT 2011


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=18558 
====================================================================== 
Reported By:                davidw
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   18558
Category:                   Channels/chan_local
Reproducibility:            have not tried
Severity:                   minor
Priority:                   normal
Status:                     ready for review
Asterisk Version:           SVN 
JIRA:                       SWP-2831 
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases): 1.6.2 
SVN Revision (number only!): 292867 
Request Review:              
====================================================================== 
Date Submitted:             2010-12-30 07:28 CST
Last Modified:              2011-05-06 16:18 CDT
====================================================================== 
Summary:                    [patch] p->chan can disappear between test and lock
in deadlock avoidance in local_hangup
Description: 
r 259899 introduces an unlock/lock sequence on p-> chan in the deadlock
avoidance for a failed lock on p->owner, in local_hangup.  However, as
noted in a comment added/modified in r 292867, and assumed by code which
tests for NULL, p->chan may be nulled whilst the lock on p is off.

Depending on exactly where the NULL is set, as well as the case that is
handled, this could result in:

1) deferencing NULL, when calling lock;
2) applying a lock to a structure that is being destroyed.
======================================================================
Relationships       ID      Summary
----------------------------------------------------------------------
related to          0018561 [patch] p->owner unregistered from m...
====================================================================== 

---------------------------------------------------------------------- 
 (0134613) dvossel (administrator) - 2011-05-06 16:18
 https://issues.asterisk.org/view.php?id=18558#c134613 
---------------------------------------------------------------------- 
This is really difficult to fix in 1.6.2.

The right fix in 1.8 would be to grab a reference to the p->chan channel
while p is locked to guarantee it won't go away.  The you have to lock the
referenced channel and see if it is still equal to p->chan after p is
locked again and all the stupid deadlock avoidance stuff is done. 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2011-05-06 16:18 dvossel        Note Added: 0134613                          
======================================================================




More information about the asterisk-bugs mailing list