mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 08:43:19 -04:00
o Remove useracc() calls from aio_qphysio(); they are redundant
given the checks performed by vmapbuf(). Reviewed by: tegge
This commit is contained in:
parent
08468b6ad7
commit
06363906bc
1 changed files with 1 additions and 20 deletions
|
|
@ -1114,29 +1114,10 @@ aio_qphysio(struct proc *p, struct aiocblist *aiocbe)
|
|||
bp->b_saveaddr = bp->b_data;
|
||||
bp->b_data = (void *)(uintptr_t)cb->aio_buf;
|
||||
bp->b_blkno = btodb(cb->aio_offset);
|
||||
|
||||
if (cb->aio_lio_opcode == LIO_WRITE) {
|
||||
bp->b_iocmd = BIO_WRITE;
|
||||
if (!useracc(bp->b_data, bp->b_bufsize, VM_PROT_READ)) {
|
||||
error = EFAULT;
|
||||
goto doerror;
|
||||
}
|
||||
} else {
|
||||
bp->b_iocmd = BIO_READ;
|
||||
if (!useracc(bp->b_data, bp->b_bufsize, VM_PROT_WRITE)) {
|
||||
error = EFAULT;
|
||||
goto doerror;
|
||||
}
|
||||
}
|
||||
bp->b_iocmd = cb->aio_lio_opcode == LIO_WRITE ? BIO_WRITE : BIO_READ;
|
||||
|
||||
/*
|
||||
* Bring buffer into kernel space.
|
||||
*
|
||||
* Note that useracc() alone is not a
|
||||
* sufficient test. vmapbuf() can still fail
|
||||
* due to a smaller file mapped into a larger
|
||||
* area of VM, or if userland races against
|
||||
* vmapbuf() after the useracc() check.
|
||||
*/
|
||||
if (vmapbuf(bp) < 0) {
|
||||
error = EFAULT;
|
||||
|
|
|
|||
Loading…
Reference in a new issue