diff options
| author | Matthew Dillon <dillon@FreeBSD.org> | 1999-01-22 05:17:56 +0000 |
|---|---|---|
| committer | Matthew Dillon <dillon@FreeBSD.org> | 1999-01-22 05:17:56 +0000 |
| commit | 57a1042a8a9aec53cbac2d5878665a25864a939c (patch) | |
| tree | ab398a452b1fc9268a5c516da6e10b93714a08c1 | |
| parent | ea3b8ac6ef269a94e13c88f271a2028a1b9c88fa (diff) | |
Notes
| -rw-r--r-- | sys/kern/kern_malloc.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index d75012d9d7eab..71d538467420a 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)kern_malloc.c 8.3 (Berkeley) 1/4/94 - * $Id: kern_malloc.c,v 1.51 1999/01/10 01:58:24 eivind Exp $ + * $Id: kern_malloc.c,v 1.51.2.1 1999/01/21 21:55:24 msmith Exp $ */ #include "opt_vm.h" @@ -122,12 +122,18 @@ malloc(size, type, flags) #endif register struct malloc_type *ksp = type; + /* + * Must be at splmem() prior to initializing segment to handle + * potential initialization race. + */ + + s = splmem(); + if (!type->ks_next) malloc_init(type); indx = BUCKETINDX(size); kbp = &bucket[indx]; - s = splmem(); while (ksp->ks_memuse >= ksp->ks_limit) { if (flags & M_NOWAIT) { splx(s); |
