Permalink
Browse files

Fixes EUCA-3962 where access to the refs path counters isn't protected.

Fixes Coverity issue #11085.
  • Loading branch information...
1 parent 8eb3f2e commit 004262dae06033309135501eb46b20a924d84da4 @gelinasc gelinasc committed Nov 21, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 storage/blobstore.c
View
@@ -492,7 +492,11 @@ static int open_and_lock (const char * path,
return -1;
}
}
- path_lock->refs++; // increase the reference count while still under lock
+ pthread_mutex_lock (&(path_lock->mutex)); // grab path-specific mutex
+ {
+ path_lock->refs++; // increase the reference count while still under lock
+ }
+ pthread_mutex_unlock (&(path_lock->mutex)); // release path-specific mutex
pthread_mutex_unlock (&_blobstore_mutex); // release global mutex
} // end of critical section

0 comments on commit 004262d

Please sign in to comment.