Lock VM Giant prior to locking a vm map.
Spotted by: Daniel Rock <D.Rock@t-online.de> Tested by: David Wolfskill <david@catwhisker.org>, Sean Eric Fagan <sef@kithrup.com>
This commit is contained in:
parent
7a4f835060
commit
f16ee52380
@ -87,6 +87,8 @@ procfs_domap(curp, p, pfs, uio)
|
||||
if (uio->uio_offset != 0)
|
||||
return (0);
|
||||
|
||||
mtx_lock(&vm_mtx);
|
||||
|
||||
error = 0;
|
||||
if (map != &curproc->p_vmspace->vm_map)
|
||||
vm_map_lock_read(map);
|
||||
@ -169,12 +171,17 @@ case OBJT_DEVICE:
|
||||
error = EFBIG;
|
||||
break;
|
||||
}
|
||||
mtx_unlock(&vm_mtx);
|
||||
error = uiomove(mebuffer, len, uio);
|
||||
mtx_lock(&vm_mtx);
|
||||
if (error)
|
||||
break;
|
||||
}
|
||||
if (map != &curproc->p_vmspace->vm_map)
|
||||
vm_map_unlock_read(map);
|
||||
|
||||
mtx_unlock(&vm_mtx);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user