svn commit: r295614 - stable/10/sys/kern
Konstantin Belousov
kib at FreeBSD.org
Sun Feb 14 18:17:59 UTC 2016
Author: kib
Date: Sun Feb 14 18:17:58 2016
New Revision: 295614
URL: https://svnweb.freebsd.org/changeset/base/295614
Log:
MFC r294596:
Limit the accesses to file' f_advice member to VREG vnodes only.
Recheck that f_advice is not NULL after lock is taken.
Approved by: re (marius)
Modified:
stable/10/sys/kern/vfs_vnops.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/sys/kern/vfs_vnops.c
==============================================================================
--- stable/10/sys/kern/vfs_vnops.c Sun Feb 14 17:21:19 2016 (r295613)
+++ stable/10/sys/kern/vfs_vnops.c Sun Feb 14 18:17:58 2016 (r295614)
@@ -733,12 +733,13 @@ get_advice(struct file *fp, struct uio *
int ret;
ret = POSIX_FADV_NORMAL;
- if (fp->f_advice == NULL)
+ if (fp->f_advice == NULL || fp->f_vnode->v_type != VREG)
return (ret);
mtxp = mtx_pool_find(mtxpool_sleep, fp);
mtx_lock(mtxp);
- if (uio->uio_offset >= fp->f_advice->fa_start &&
+ if (fp->f_advice != NULL &&
+ uio->uio_offset >= fp->f_advice->fa_start &&
uio->uio_offset + uio->uio_resid <= fp->f_advice->fa_end)
ret = fp->f_advice->fa_advice;
mtx_unlock(mtxp);
More information about the svn-src-stable
mailing list