aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfsd/nfsfh.c9
-rw-r--r--fs/nfsd/vfs.c6
2 files changed, 4 insertions, 11 deletions
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
index 90c6aa6d5e0f..8cd49b9bf085 100644
--- a/fs/nfsd/nfsfh.c
+++ b/fs/nfsd/nfsfh.c
@@ -61,7 +61,6 @@ static int nfsd_acceptable(void *expv, struct dentry *dentry)
61static inline __be32 61static inline __be32
62nfsd_mode_check(struct svc_rqst *rqstp, umode_t mode, int type) 62nfsd_mode_check(struct svc_rqst *rqstp, umode_t mode, int type)
63{ 63{
64 /* Type can be negative when creating hardlinks - not to a dir */
65 if (type > 0 && (mode & S_IFMT) != type) { 64 if (type > 0 && (mode & S_IFMT) != type) {
66 if (rqstp->rq_vers == 4 && (mode & S_IFMT) == S_IFLNK) 65 if (rqstp->rq_vers == 4 && (mode & S_IFMT) == S_IFLNK)
67 return nfserr_symlink; 66 return nfserr_symlink;
@@ -72,14 +71,6 @@ nfsd_mode_check(struct svc_rqst *rqstp, umode_t mode, int type)
72 else 71 else
73 return nfserr_inval; 72 return nfserr_inval;
74 } 73 }
75 if (type < 0 && (mode & S_IFMT) == -type) {
76 if (rqstp->rq_vers == 4 && (mode & S_IFMT) == S_IFLNK)
77 return nfserr_symlink;
78 else if (type == -S_IFDIR)
79 return nfserr_isdir;
80 else
81 return nfserr_notdir;
82 }
83 return 0; 74 return 0;
84} 75}
85 76
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index fd0acca5370a..0c92a17d1770 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -1632,10 +1632,12 @@ nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp,
1632 err = fh_verify(rqstp, ffhp, S_IFDIR, NFSD_MAY_CREATE); 1632 err = fh_verify(rqstp, ffhp, S_IFDIR, NFSD_MAY_CREATE);
1633 if (err) 1633 if (err)
1634 goto out; 1634 goto out;
1635 err = fh_verify(rqstp, tfhp, -S_IFDIR, NFSD_MAY_NOP); 1635 err = fh_verify(rqstp, tfhp, 0, NFSD_MAY_NOP);
1636 if (err) 1636 if (err)
1637 goto out; 1637 goto out;
1638 1638 err = nfserr_isdir;
1639 if (S_ISDIR(tfhp->fh_dentry->d_inode->i_mode))
1640 goto out;
1639 err = nfserr_perm; 1641 err = nfserr_perm;
1640 if (!len) 1642 if (!len)
1641 goto out; 1643 goto out;