aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/vfs_aio.c
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2007-08-20 11:53:26 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2007-08-20 11:53:26 +0000
commit5114048b635a332f9a5dbfba06a7c87807a5f163 (patch)
tree6700df77772bc34234d170c4690b9f3dd0e3997f /sys/kern/vfs_aio.c
parent67e20930bd16a74587bab4949a3923009de6a8ca (diff)
downloadsrc-5114048b635a332f9a5dbfba06a7c87807a5f163.tar.gz
src-5114048b635a332f9a5dbfba06a7c87807a5f163.zip
Destroy the kaio_mtx on the freeing the struct kaioinfo in the
aio_proc_rundown. Do not allow for zero-length read to be passed to the fo_read file method by aio. Reported and tested by: Peter Holm Approved by: re (kensmith)
Notes
Notes: svn path=/head/; revision=171901
Diffstat (limited to 'sys/kern/vfs_aio.c')
-rw-r--r--sys/kern/vfs_aio.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c
index 85896f2c0d6b..842b43570412 100644
--- a/sys/kern/vfs_aio.c
+++ b/sys/kern/vfs_aio.c
@@ -719,6 +719,7 @@ restart:
}
AIO_UNLOCK(ki);
taskqueue_drain(taskqueue_aiod_bio, &ki->kaio_task);
+ mtx_destroy(&ki->kaio_mtx);
uma_zfree(kaio_zone, ki);
p->p_aioinfo = NULL;
}
@@ -837,7 +838,10 @@ aio_process(struct aiocblist *aiocbe)
*/
if (cb->aio_lio_opcode == LIO_READ) {
auio.uio_rw = UIO_READ;
- error = fo_read(fp, &auio, fp->f_cred, FOF_OFFSET, td);
+ if (auio.uio_resid == 0)
+ error = 0;
+ else
+ error = fo_read(fp, &auio, fp->f_cred, FOF_OFFSET, td);
} else {
if (fp->f_type == DTYPE_VNODE)
bwillwrite();