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.
This commit is contained in:
parent
615beb1f86
commit
c7003c6991
@ -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 @@ kmem_malloc(map, size, flags)
|
||||
*/
|
||||
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 @@ kmem_malloc(map, size, flags)
|
||||
*/
|
||||
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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user