Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 106374
b: refs/heads/master
c: 256984a
h: refs/heads/master
v: v3
  • Loading branch information
Al Viro committed Jul 27, 2008
1 parent 09282a0 commit d97a233
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f419a2e3b64def707e1384ee38abb77f99af5f6d
refs/heads/master: 256984a83880ff7ac78055cb87baea48137f0b77
2 changes: 1 addition & 1 deletion trunk/fs/inotify_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ static int find_inode(const char __user *dirname, struct nameidata *nd,
if (error)
return error;
/* you can only watch an inode if you have read permissions on it */
error = vfs_permission(nd, MAY_READ);
error = inode_permission(nd->path.dentry->d_inode, MAY_READ);
if (error)
path_put(&nd->path);
return error;
Expand Down
18 changes: 10 additions & 8 deletions trunk/fs/open.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ static long do_sys_truncate(const char __user * path, loff_t length)
if (error)
goto dput_and_out;

error = vfs_permission(&nd, MAY_WRITE);
error = inode_permission(inode, MAY_WRITE);
if (error)
goto mnt_drop_write_and_out;

Expand Down Expand Up @@ -426,6 +426,7 @@ asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len)
asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode)
{
struct nameidata nd;
struct inode *inode;
int old_fsuid, old_fsgid;
kernel_cap_t uninitialized_var(old_cap); /* !SECURE_NO_SETUID_FIXUP */
int res;
Expand Down Expand Up @@ -461,7 +462,9 @@ asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode)
if (res)
goto out;

if ((mode & MAY_EXEC) && S_ISREG(nd.path.dentry->d_inode->i_mode)) {
inode = nd.path.dentry->d_inode;

if ((mode & MAY_EXEC) && S_ISREG(inode->i_mode)) {
/*
* MAY_EXEC on regular files is denied if the fs is mounted
* with the "noexec" flag.
Expand All @@ -471,10 +474,9 @@ asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode)
goto out_path_release;
}

res = vfs_permission(&nd, mode | MAY_ACCESS);
res = inode_permission(inode, mode | MAY_ACCESS);
/* SuS v2 requires we report a read only fs too */
if(res || !(mode & S_IWOTH) ||
special_file(nd.path.dentry->d_inode->i_mode))
if (res || !(mode & S_IWOTH) || special_file(inode->i_mode))
goto out_path_release;
/*
* This is a rare case where using __mnt_is_readonly()
Expand Down Expand Up @@ -515,7 +517,7 @@ asmlinkage long sys_chdir(const char __user * filename)
if (error)
goto out;

error = vfs_permission(&nd, MAY_EXEC | MAY_ACCESS);
error = inode_permission(nd.path.dentry->d_inode, MAY_EXEC | MAY_ACCESS);
if (error)
goto dput_and_out;

Expand Down Expand Up @@ -544,7 +546,7 @@ asmlinkage long sys_fchdir(unsigned int fd)
if (!S_ISDIR(inode->i_mode))
goto out_putf;

error = file_permission(file, MAY_EXEC | MAY_ACCESS);
error = inode_permission(inode, MAY_EXEC | MAY_ACCESS);
if (!error)
set_fs_pwd(current->fs, &file->f_path);
out_putf:
Expand All @@ -562,7 +564,7 @@ asmlinkage long sys_chroot(const char __user * filename)
if (error)
goto out;

error = vfs_permission(&nd, MAY_EXEC | MAY_ACCESS);
error = inode_permission(nd.path.dentry->d_inode, MAY_EXEC | MAY_ACCESS);
if (error)
goto dput_and_out;

Expand Down

0 comments on commit d97a233

Please sign in to comment.