Skip to content

Commit d88520a

Browse files
committed
Merge tag 'pull-nfsd-fix' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull nfsd fix from Al Viro: "Catch from lock_rename() audit; nfsd_rename() checked that both directories belonged to the same filesystem, but only after having done lock_rename(). Trivial fix, tested and acked by nfs folks" * tag 'pull-nfsd-fix' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: nfsd: lock_rename() needs both directories to live on the same fs
2 parents 84186fc + 1aee915 commit d88520a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

fs/nfsd/vfs.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1788,6 +1788,12 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen,
17881788
if (!flen || isdotent(fname, flen) || !tlen || isdotent(tname, tlen))
17891789
goto out;
17901790

1791+
err = (rqstp->rq_vers == 2) ? nfserr_acces : nfserr_xdev;
1792+
if (ffhp->fh_export->ex_path.mnt != tfhp->fh_export->ex_path.mnt)
1793+
goto out;
1794+
if (ffhp->fh_export->ex_path.dentry != tfhp->fh_export->ex_path.dentry)
1795+
goto out;
1796+
17911797
retry:
17921798
host_err = fh_want_write(ffhp);
17931799
if (host_err) {
@@ -1823,12 +1829,6 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen,
18231829
if (ndentry == trap)
18241830
goto out_dput_new;
18251831

1826-
host_err = -EXDEV;
1827-
if (ffhp->fh_export->ex_path.mnt != tfhp->fh_export->ex_path.mnt)
1828-
goto out_dput_new;
1829-
if (ffhp->fh_export->ex_path.dentry != tfhp->fh_export->ex_path.dentry)
1830-
goto out_dput_new;
1831-
18321832
if ((ndentry->d_sb->s_export_op->flags & EXPORT_OP_CLOSE_BEFORE_UNLINK) &&
18331833
nfsd_has_cached_files(ndentry)) {
18341834
close_cached = true;

0 commit comments

Comments
 (0)