diff options
author | James Morris <jmorris@namei.org> | 2009-02-05 19:01:45 -0500 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2009-02-05 19:01:45 -0500 |
commit | cb5629b10d64a8006622ce3a52bc887d91057d69 (patch) | |
tree | 7c06d8f30783115e3384721046258ce615b129c5 /fs/nfsd/nfsfh.c | |
parent | 8920d5ad6ba74ae8ab020e90cc4d976980e68701 (diff) | |
parent | f01d1d546abb2f4028b5299092f529eefb01253a (diff) |
Merge branch 'master' into next
Conflicts:
fs/namei.c
Manually merged per:
diff --cc fs/namei.c
index 734f2b5,bbc15c2..0000000
--- a/fs/namei.c
+++ b/fs/namei.c
@@@ -860,9 -848,8 +849,10 @@@ static int __link_path_walk(const char
nd->flags |= LOOKUP_CONTINUE;
err = exec_permission_lite(inode);
if (err == -EAGAIN)
- err = vfs_permission(nd, MAY_EXEC);
+ err = inode_permission(nd->path.dentry->d_inode,
+ MAY_EXEC);
+ if (!err)
+ err = ima_path_check(&nd->path, MAY_EXEC);
if (err)
break;
@@@ -1525,14 -1506,9 +1509,14 @@@ int may_open(struct path *path, int acc
flag &= ~O_TRUNC;
}
- error = vfs_permission(nd, acc_mode);
+ error = inode_permission(inode, acc_mode);
if (error)
return error;
+
- error = ima_path_check(&nd->path,
++ error = ima_path_check(path,
+ acc_mode & (MAY_READ | MAY_WRITE | MAY_EXEC));
+ if (error)
+ return error;
/*
* An append-only file must be opened in append mode for writing.
*/
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'fs/nfsd/nfsfh.c')
-rw-r--r-- | fs/nfsd/nfsfh.c | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c index f0da7d9c3a92..9f1ca17293d3 100644 --- a/fs/nfsd/nfsfh.c +++ b/fs/nfsd/nfsfh.c | |||
@@ -258,14 +258,32 @@ out: | |||
258 | return error; | 258 | return error; |
259 | } | 259 | } |
260 | 260 | ||
261 | /* | 261 | /** |
262 | * Perform sanity checks on the dentry in a client's file handle. | 262 | * fh_verify - filehandle lookup and access checking |
263 | * @rqstp: pointer to current rpc request | ||
264 | * @fhp: filehandle to be verified | ||
265 | * @type: expected type of object pointed to by filehandle | ||
266 | * @access: type of access needed to object | ||
267 | * | ||
268 | * Look up a dentry from the on-the-wire filehandle, check the client's | ||
269 | * access to the export, and set the current task's credentials. | ||
270 | * | ||
271 | * Regardless of success or failure of fh_verify(), fh_put() should be | ||
272 | * called on @fhp when the caller is finished with the filehandle. | ||
263 | * | 273 | * |
264 | * Note that the file handle dentry may need to be freed even after | 274 | * fh_verify() may be called multiple times on a given filehandle, for |
265 | * an error return. | 275 | * example, when processing an NFSv4 compound. The first call will look |
276 | * up a dentry using the on-the-wire filehandle. Subsequent calls will | ||
277 | * skip the lookup and just perform the other checks and possibly change | ||
278 | * the current task's credentials. | ||
266 | * | 279 | * |
267 | * This is only called at the start of an nfsproc call, so fhp points to | 280 | * @type specifies the type of object expected using one of the S_IF* |
268 | * a svc_fh which is all 0 except for the over-the-wire file handle. | 281 | * constants defined in include/linux/stat.h. The caller may use zero |
282 | * to indicate that it doesn't care, or a negative integer to indicate | ||
283 | * that it expects something not of the given type. | ||
284 | * | ||
285 | * @access is formed from the NFSD_MAY_* constants defined in | ||
286 | * include/linux/nfsd/nfsd.h. | ||
269 | */ | 287 | */ |
270 | __be32 | 288 | __be32 |
271 | fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access) | 289 | fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access) |
@@ -466,6 +484,8 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, | |||
466 | goto retry; | 484 | goto retry; |
467 | break; | 485 | break; |
468 | } | 486 | } |
487 | } else if (exp->ex_flags & NFSEXP_FSID) { | ||
488 | fsid_type = FSID_NUM; | ||
469 | } else if (exp->ex_uuid) { | 489 | } else if (exp->ex_uuid) { |
470 | if (fhp->fh_maxsize >= 64) { | 490 | if (fhp->fh_maxsize >= 64) { |
471 | if (root_export) | 491 | if (root_export) |
@@ -478,9 +498,7 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, | |||
478 | else | 498 | else |
479 | fsid_type = FSID_UUID4_INUM; | 499 | fsid_type = FSID_UUID4_INUM; |
480 | } | 500 | } |
481 | } else if (exp->ex_flags & NFSEXP_FSID) | 501 | } else if (!old_valid_dev(ex_dev)) |
482 | fsid_type = FSID_NUM; | ||
483 | else if (!old_valid_dev(ex_dev)) | ||
484 | /* for newer device numbers, we must use a newer fsid format */ | 502 | /* for newer device numbers, we must use a newer fsid format */ |
485 | fsid_type = FSID_ENCODE_DEV; | 503 | fsid_type = FSID_ENCODE_DEV; |
486 | else | 504 | else |