summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_kern.c
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>1999-03-16 07:39:07 +0000
committeralc <alc@FreeBSD.org>1999-03-16 07:39:07 +0000
commit57d921a394105859ef749c2f1a49b291925ed38d (patch)
tree0ec30c28e75820546aeae059c0cd308f12bd585d /sys/vm/vm_kern.c
parentf7a7179f0fecc8d4e0dfb40980a3f903f39c5271 (diff)
downloadFreeBSD-src-57d921a394105859ef749c2f1a49b291925ed38d.zip
FreeBSD-src-57d921a394105859ef749c2f1a49b291925ed38d.tar.gz
Correct a problem in kmem_malloc: A kmem_malloc allowing "wait" may
block (VM_WAIT) holding the map lock. This is bad. For example, a subsequent kmem_malloc by an interrupt handler on the same map may find the lock held and panic in the lockmgr.
Diffstat (limited to 'sys/vm/vm_kern.c')
-rw-r--r--sys/vm/vm_kern.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/vm/vm_kern.c b/sys/vm/vm_kern.c
index d4feb44..16c6208 100644
--- a/sys/vm/vm_kern.c
+++ b/sys/vm/vm_kern.c
@@ -61,7 +61,7 @@
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
- * $Id: vm_kern.c,v 1.52 1999/01/21 09:38:20 dillon Exp $
+ * $Id: vm_kern.c,v 1.53 1999/03/12 08:05:49 alc Exp $
*/
/*
@@ -337,7 +337,9 @@ retry:
*/
if (m == NULL) {
if ((flags & M_NOWAIT) == 0) {
+ vm_map_unlock(map);
VM_WAIT;
+ vm_map_lock(map);
goto retry;
}
vm_map_delete(map, addr, addr + size);
@@ -359,9 +361,9 @@ retry:
*/
if (!vm_map_lookup_entry(map, addr, &entry) ||
entry->start != addr || entry->end != addr + size ||
- entry->wired_count)
+ entry->wired_count != 0)
panic("kmem_malloc: entry not found or misaligned");
- entry->wired_count++;
+ entry->wired_count = 1;
vm_map_simplify_entry(map, entry);
OpenPOWER on IntegriCloud