mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
Allow negative aio_offset only for the read and write LIO ops on
device nodes. Otherwise, the current check of aio_offset == -1LL makes it possible to pass negative file offsets down to the filesystems. This trips assertions and is even unsafe for e.g. FFS which keeps metadata at negative offsets. Reported and tested by: pho Reviewed by: jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D11266
This commit is contained in:
parent
eeafb4bc10
commit
711dba24d7
1 changed files with 3 additions and 1 deletions
|
|
@ -1550,7 +1550,9 @@ aio_aqueue(struct thread *td, struct aiocb *ujob, struct aioliojob *lj,
|
|||
goto aqueue_fail;
|
||||
}
|
||||
|
||||
if (opcode != LIO_SYNC && job->uaiocb.aio_offset == -1LL) {
|
||||
if ((opcode == LIO_READ || opcode == LIO_WRITE) &&
|
||||
job->uaiocb.aio_offset < 0 &&
|
||||
(fp->f_vnode == NULL || fp->f_vnode->v_type != VCHR)) {
|
||||
error = EINVAL;
|
||||
goto aqueue_fail;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue