From abe50d83e61c4d36e816de10e1c6a1eae2a07df3 Mon Sep 17 00:00:00 2001 From: jmg Date: Fri, 24 Oct 2003 21:07:53 +0000 Subject: don't allow reading from files that haven't been open'd for reading. --- sys/kern/vfs_aio.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sys/kern/vfs_aio.c') diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c index b746f47..6642fde 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -1330,8 +1330,9 @@ _aio_aqueue(struct thread *td, struct aiocb *job, struct aio_liojob *lj, int typ } fp = aiocbe->fd_file = fdp->fd_ofiles[fd]; - if ((fp == NULL) || ((opcode == LIO_WRITE) && ((fp->f_flag & FWRITE) == - 0))) { + if ((fp == NULL) || + ((opcode == LIO_WRITE) && ((fp->f_flag & FWRITE) == 0)) || + ((opcode == LIO_READ) && ((fp->f_flag & FREAD) == 0))) { FILEDESC_UNLOCK(fdp); uma_zfree(aiocb_zone, aiocbe); if (type == 0) -- cgit v1.1