aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorDave Hansen <haveblue@us.ibm.com>2007-10-17 02:31:14 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-17 11:43:05 -0400
commitc7eb26678e59f16f4e84f1176d187cd21a27414d (patch)
treebf58c7f877846d204d417021b8608e1446bc3ea8 /fs/namei.c
parentb41572e929221b0d87f529106cdf12185ee84bca (diff)
r/o bind mounts: give permission() a local 'mnt' variable
First of all, this makes the structure jumping look a little bit cleaner. So, this stands alone as a tiny cleanup. But, we also need 'mnt' by itself a few more times later in this series, so this isn't _just_ a cleanup. Signed-off-by: Dave Hansen <haveblue@us.ibm.com> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/namei.c b/fs/namei.c
index a29bb0f40ed5..464eeccb675b 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -228,6 +228,10 @@ int generic_permission(struct inode *inode, int mask,
228int permission(struct inode *inode, int mask, struct nameidata *nd) 228int permission(struct inode *inode, int mask, struct nameidata *nd)
229{ 229{
230 int retval, submask; 230 int retval, submask;
231 struct vfsmount *mnt = NULL;
232
233 if (nd)
234 mnt = nd->mnt;
231 235
232 if (mask & MAY_WRITE) { 236 if (mask & MAY_WRITE) {
233 umode_t mode = inode->i_mode; 237 umode_t mode = inode->i_mode;
@@ -251,7 +255,7 @@ int permission(struct inode *inode, int mask, struct nameidata *nd)
251 * MAY_EXEC on regular files is denied if the fs is mounted 255 * MAY_EXEC on regular files is denied if the fs is mounted
252 * with the "noexec" flag. 256 * with the "noexec" flag.
253 */ 257 */
254 if (nd && nd->mnt && (nd->mnt->mnt_flags & MNT_NOEXEC)) 258 if (mnt && (mnt->mnt_flags & MNT_NOEXEC))
255 return -EACCES; 259 return -EACCES;
256 } 260 }
257 261