Skip to content

Commit

Permalink
r/o bind mounts: give permission() a local 'mnt' variable
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
hansendc authored and Linus Torvalds committed Oct 17, 2007
1 parent b41572e commit c7eb266
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,10 @@ int generic_permission(struct inode *inode, int mask,
int permission(struct inode *inode, int mask, struct nameidata *nd)
{
int retval, submask;
struct vfsmount *mnt = NULL;

if (nd)
mnt = nd->mnt;

if (mask & MAY_WRITE) {
umode_t mode = inode->i_mode;
Expand All @@ -251,7 +255,7 @@ int permission(struct inode *inode, int mask, struct nameidata *nd)
* MAY_EXEC on regular files is denied if the fs is mounted
* with the "noexec" flag.
*/
if (nd && nd->mnt && (nd->mnt->mnt_flags & MNT_NOEXEC))
if (mnt && (mnt->mnt_flags & MNT_NOEXEC))
return -EACCES;
}

Expand Down

0 comments on commit c7eb266

Please sign in to comment.