diff options
author | gibbs <gibbs@FreeBSD.org> | 2011-06-13 21:21:02 +0000 |
---|---|---|
committer | gibbs <gibbs@FreeBSD.org> | 2011-06-13 21:21:02 +0000 |
commit | f3f56007b6ff44fbfe31c8000573e05bc31a6234 (patch) | |
tree | a3425da958868cb6bcf024e812b8ec92b6758ef0 /contrib/llvm/lib/CodeGen/ELFWriter.cpp | |
parent | 16addb86733d970dc3f900be1a0536276292efbe (diff) | |
download | FreeBSD-src-f3f56007b6ff44fbfe31c8000573e05bc31a6234.zip FreeBSD-src-f3f56007b6ff44fbfe31c8000573e05bc31a6234.tar.gz |
Fix a couple of race conditions in devstat(9) initialization.
In devstat_new_entry(), there is no need to initialize the queue
and the mutex in this function. There are ways to do static
initialization on both, so use STAILQ_HEAD_INITIALIZER and
MTX_SYSINIT to initialize the queue and the mutex.
In devstat_alloc(), use an atomic test and set routine to guard
making our entry in /dev. Using just a plain static variable
creates a race condition on multiprocessor machines. If you
attempt to create a second entry in devfs, the kernel will panic.
Submitted by: kdm
Reviewed by: gibbs
Sponsored by: Spectra Logic Corporation
MFC after: 1 week.
Diffstat (limited to 'contrib/llvm/lib/CodeGen/ELFWriter.cpp')
0 files changed, 0 insertions, 0 deletions