diff --git a/sys/vm/vm_kern.c b/sys/vm/vm_kern.c index 12608a661fc1..18c7d5093865 100644 --- a/sys/vm/vm_kern.c +++ b/sys/vm/vm_kern.c @@ -384,11 +384,13 @@ kmem_malloc(map, size, flags) */ while (i != 0) { i -= PAGE_SIZE; + vm_object_lock(kmem_object); m = vm_page_lookup(kmem_object, OFF_TO_IDX(offset + i)); vm_page_lock_queues(); vm_page_free(m); vm_page_unlock_queues(); + vm_object_unlock(kmem_object); } vm_map_delete(map, addr, addr + size); vm_map_unlock(map); @@ -420,7 +422,9 @@ kmem_malloc(map, size, flags) * splimp...) */ for (i = 0; i < size; i += PAGE_SIZE) { + vm_object_lock(kmem_object); m = vm_page_lookup(kmem_object, OFF_TO_IDX(offset + i)); + vm_object_unlock(kmem_object); vm_page_lock_queues(); vm_page_wire(m); vm_page_wakeup(m);