diff options
author | Alan Somers <asomers@FreeBSD.org> | 2021-01-01 20:49:30 +0000 |
---|---|---|
committer | Alan Somers <asomers@FreeBSD.org> | 2021-01-03 18:16:20 +0000 |
commit | 17a82e6af8e2bde543c9c2fbe3ce296d5b24ddc9 (patch) | |
tree | 2861fbb133e9401730474bd51c9075687f241428 | |
parent | 845b2737289564c90ddf7fcf01bb0275f0e8d937 (diff) |
Fix vnode locking bug in fuse_vnop_copy_file_range
MFC-With: 92bbfe1f0d1f1c4436d1f064a16e5aaf682526ba
Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D27938
-rw-r--r-- | sys/fs/fuse/fuse_vnops.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c index f26f96b8be99..5bbde1e278c9 100644 --- a/sys/fs/fuse/fuse_vnops.c +++ b/sys/fs/fuse/fuse_vnops.c @@ -664,14 +664,6 @@ fuse_vnop_copy_file_range(struct vop_copy_file_range_args *ap) td = ap->a_fsizetd; pid = td->td_proc->p_pid; - err = fuse_filehandle_getrw(invp, FREAD, &infufh, incred, pid); - if (err) - return (err); - - err = fuse_filehandle_getrw(outvp, FWRITE, &outfufh, outcred, pid); - if (err) - return (err); - /* Lock both vnodes, avoiding risk of deadlock. */ do { err = vn_lock(outvp, LK_EXCLUSIVE); @@ -690,6 +682,14 @@ fuse_vnop_copy_file_range(struct vop_copy_file_range_args *ap) if (err != 0) return (err); + err = fuse_filehandle_getrw(invp, FREAD, &infufh, incred, pid); + if (err) + goto unlock; + + err = fuse_filehandle_getrw(outvp, FWRITE, &outfufh, outcred, pid); + if (err) + goto unlock; + if (ap->a_fsizetd) { io.uio_offset = *ap->a_outoffp; io.uio_resid = *ap->a_lenp; |