[asterisk-bugs] [Zaptel 0009379]: [patch] zt_specchan_open race because ZT_FLAG_OPEN testing and setting is not atomic

noreply at bugs.digium.com noreply at bugs.digium.com
Sat Apr 5 18:04:26 CDT 2008


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=9379 
====================================================================== 
Reported By:                Matti
Assigned To:                mattf
====================================================================== 
Project:                    Zaptel
Issue ID:                   9379
Category:                   zaptel (the module)
Reproducibility:            have not tried
Severity:                   minor
Priority:                   normal
Status:                     assigned
Zaptel Version:             1.4.7.1  
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Disclaimer on File?:        No 
Request Review:              
====================================================================== 
Date Submitted:             03-26-2007 07:55 CDT
Last Modified:              04-05-2008 18:04 CDT
====================================================================== 
Summary:                    [patch] zt_specchan_open race because ZT_FLAG_OPEN
testing and setting is not atomic
Description: 
Function zt_specchan_open in file zaptel.c can have a race condition
because ZT_FLAG_OPEN testing and setting is not atomic. The function should
check and set the flag holding the spin lock continuously in and between
the following lines:
if (chans[unit]->flags & ZT_FLAG_OPEN)
chans[unit]->flags |= ZT_FLAG_OPEN;
======================================================================
Relationships       ID      Summary
----------------------------------------------------------------------
related to          0010806 Channel opening and unregistering race
====================================================================== 

---------------------------------------------------------------------- 
 mattf - 04-05-08 18:04  
---------------------------------------------------------------------- 
I think I agree with Mark.  Many of these issues would be much simpler if
we used the atomic test_and_set and test_and_clear_bit routines.  I'm
currently auditing a few of these code paths and will add some patches
which use these routines to fix this issue.  I'm starting with the
open/release routines.  An initial version of my patch for these routines
is about to be attached, Matti, if you would like to see how I am doing it
and critique. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
04-05-08 18:04  mattf          Note Added: 0085046                          
======================================================================




More information about the asterisk-bugs mailing list