Module Name: src Committed By: hannken Date: Mon Jun 17 08:08:21 UTC 2019
Modified Files: src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vnops.c Log Message: Add fstrans_start()/fstrans_done() and bounds check to zfs_netbsd_getpages(). To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 \ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.49 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.50 --- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.49 Mon Jun 17 08:07:56 2019 +++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c Mon Jun 17 08:08:21 2019 @@ -5892,6 +5892,7 @@ zfs_netbsd_getpages(void *v) kmutex_t * const mtx = uobj->vmobjlock; znode_t *zp = VTOZ(vp); zfsvfs_t *zfsvfs = zp->z_zfsvfs; + vfs_t *mp; struct vm_page *pg; caddr_t va; int npages, found, err = 0; @@ -5910,10 +5911,22 @@ zfs_netbsd_getpages(void *v) return EBUSY; } + mp = vp->v_mount; + fstrans_start(mp); + if (vp->v_mount != mp) { + fstrans_done(mp); + return ENOENT; + } ZFS_ENTER(zfsvfs); ZFS_VERIFY_ZP(zp); mutex_enter(mtx); + if (offset >= vp->v_size) { + mutex_exit(mtx); + ZFS_EXIT(zfsvfs); + fstrans_done(mp); + return EINVAL; + } npages = 1; pg = NULL; uvn_findpages(uobj, offset, &npages, &pg, UFP_ALL); @@ -5943,6 +5956,7 @@ zfs_netbsd_getpages(void *v) ap->a_m[ap->a_centeridx] = pg; ZFS_EXIT(zfsvfs); + fstrans_done(mp); return (err); }