]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Summary: Fix race in UFS code.
authorrobertc <>
Sun, 31 Aug 2003 18:44:30 +0000 (18:44 +0000)
committerrobertc <>
Sun, 31 Aug 2003 18:44:30 +0000 (18:44 +0000)
Keywords:

UFS had a race leading to a refcount triggered free within a method.

src/StoreIOState.cc
src/fs/ufs/store_io_ufs.cc

index c6eb20834b61f0d82f6faaeacbbe20af90c3bca2..a2bfb963d5c3879978eec1f7bbec72a6e1bf0d82 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: StoreIOState.cc,v 1.3 2003/02/21 22:50:06 robertc Exp $
+ * $Id: StoreIOState.cc,v 1.4 2003/08/31 12:44:30 robertc Exp $
  *
  * DEBUG: section ??    Swap Dir base object
  * AUTHOR: Robert Collins
@@ -59,6 +59,8 @@ storeIOState::offset() const
 
 storeIOState::~storeIOState()
 {
+    debugs(20,3, "StoreIOState::~StoreIOState: " << this);
+
     if (read.callback_data)
         cbdataReferenceDone(read.callback_data);
 
index b7bd27016e87486b80f409d8cf260c3c731a7ffe..ec4311e4a427d5976fe567a3fa237cffda949bf0 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_io_ufs.cc,v 1.22 2003/08/04 22:14:53 robertc Exp $
+ * $Id: store_io_ufs.cc,v 1.23 2003/08/31 12:44:31 robertc Exp $
  *
  * DEBUG: section 79    Storage Manager UFS Interface
  * AUTHOR: Duane Wessels
@@ -471,9 +471,6 @@ void
 UFSStoreState::doCallback(int errflag)
 {
     debug(79, 3) ("storeUfsIOCallback: errflag=%d\n", errflag);
-    /* We are finished with the file as this is on close or error only.*/
-    theFile = NULL;
-
     STIOCB *theCallback = callback;
     callback = NULL;
 
@@ -481,6 +478,12 @@ UFSStoreState::doCallback(int errflag)
 
     if (cbdataReferenceValidDone(callback_data, &cbdata) && theCallback)
         theCallback(cbdata, errflag, this);
+
+    /* We are finished with the file as this is on close or error only.*/
+    /* This must be the last line, as theFile may be the only object holding
+     * us in memory 
+     */
+    theFile = NULL;
 }
 
 /* ============= THE REAL UFS CODE ================ */