Commit 7aebcc3f authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] nfs: Fix readonly mounts

From: Trond Myklebust <trond.myklebust@fys.uio.no>

The nfs_permission() code needs to check for "local" mount flags such as
"ro" *before* it decides to optimize away any permissions tests.
parent 7de3a7b2
......@@ -1281,13 +1281,8 @@ nfs_permission(struct inode *inode, int mask, struct nameidata *nd)
int mode = inode->i_mode;
int res;
/* Are we checking permissions on anything other than lookup? */
if (!(mask & MAY_EXEC)) {
/* We only need to check permissions on file open() and access() */
if (!nd || !(nd->flags & (LOOKUP_OPEN|LOOKUP_ACCESS)))
if (mask == 0)
return 0;
}
if (mask & MAY_WRITE) {
/*
*
......@@ -1306,6 +1301,12 @@ nfs_permission(struct inode *inode, int mask, struct nameidata *nd)
if (IS_IMMUTABLE(inode))
return -EACCES;
}
/* Are we checking permissions on anything other than lookup/execute? */
if ((mask & MAY_EXEC) == 0) {
/* We only need to check permissions on file open() and access() */
if (!nd || !(nd->flags & (LOOKUP_OPEN|LOOKUP_ACCESS)))
return 0;
}
lock_kernel();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment