summaryrefslogtreecommitdiff
path: root/fs/namei.c
diff options
context:
space:
mode:
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 a29bb0f40ed..464eeccb675 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -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;
@@ -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;
}