aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2008-07-22 08:09:30 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2008-07-26 20:53:32 -0400
commit256984a83880ff7ac78055cb87baea48137f0b77 (patch)
treea6a98bd747503df5d302b80aefd691db2a508252 /fs
parentf419a2e3b64def707e1384ee38abb77f99af5f6d (diff)
[PATCH] preparation to __user_walk_fd cleanup
Almost all users __user_walk_fd() and friends care only about struct path. Get rid of the few that do not. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/inotify_user.c2
-rw-r--r--fs/open.c18
2 files changed, 11 insertions, 9 deletions
diff --git a/fs/inotify_user.c b/fs/inotify_user.c
index fe79c25d95dc..9b99ebf28884 100644
--- a/fs/inotify_user.c
+++ b/fs/inotify_user.c
@@ -365,7 +365,7 @@ static int find_inode(const char __user *dirname, struct nameidata *nd,
365 if (error) 365 if (error)
366 return error; 366 return error;
367 /* you can only watch an inode if you have read permissions on it */ 367 /* you can only watch an inode if you have read permissions on it */
368 error = vfs_permission(nd, MAY_READ); 368 error = inode_permission(nd->path.dentry->d_inode, MAY_READ);
369 if (error) 369 if (error)
370 path_put(&nd->path); 370 path_put(&nd->path);
371 return error; 371 return error;
diff --git a/fs/open.c b/fs/open.c
index d5e421ad0cf6..e94266700eda 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -251,7 +251,7 @@ static long do_sys_truncate(const char __user * path, loff_t length)
251 if (error) 251 if (error)
252 goto dput_and_out; 252 goto dput_and_out;
253 253
254 error = vfs_permission(&nd, MAY_WRITE); 254 error = inode_permission(inode, MAY_WRITE);
255 if (error) 255 if (error)
256 goto mnt_drop_write_and_out; 256 goto mnt_drop_write_and_out;
257 257
@@ -426,6 +426,7 @@ out:
426asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode) 426asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode)
427{ 427{
428 struct nameidata nd; 428 struct nameidata nd;
429 struct inode *inode;
429 int old_fsuid, old_fsgid; 430 int old_fsuid, old_fsgid;
430 kernel_cap_t uninitialized_var(old_cap); /* !SECURE_NO_SETUID_FIXUP */ 431 kernel_cap_t uninitialized_var(old_cap); /* !SECURE_NO_SETUID_FIXUP */
431 int res; 432 int res;
@@ -461,7 +462,9 @@ asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode)
461 if (res) 462 if (res)
462 goto out; 463 goto out;
463 464
464 if ((mode & MAY_EXEC) && S_ISREG(nd.path.dentry->d_inode->i_mode)) { 465 inode = nd.path.dentry->d_inode;
466
467 if ((mode & MAY_EXEC) && S_ISREG(inode->i_mode)) {
465 /* 468 /*
466 * MAY_EXEC on regular files is denied if the fs is mounted 469 * MAY_EXEC on regular files is denied if the fs is mounted
467 * with the "noexec" flag. 470 * with the "noexec" flag.
@@ -471,10 +474,9 @@ asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode)
471 goto out_path_release; 474 goto out_path_release;
472 } 475 }
473 476
474 res = vfs_permission(&nd, mode | MAY_ACCESS); 477 res = inode_permission(inode, mode | MAY_ACCESS);
475 /* SuS v2 requires we report a read only fs too */ 478 /* SuS v2 requires we report a read only fs too */
476 if(res || !(mode & S_IWOTH) || 479 if (res || !(mode & S_IWOTH) || special_file(inode->i_mode))
477 special_file(nd.path.dentry->d_inode->i_mode))
478 goto out_path_release; 480 goto out_path_release;
479 /* 481 /*
480 * This is a rare case where using __mnt_is_readonly() 482 * This is a rare case where using __mnt_is_readonly()
@@ -515,7 +517,7 @@ asmlinkage long sys_chdir(const char __user * filename)
515 if (error) 517 if (error)
516 goto out; 518 goto out;
517 519
518 error = vfs_permission(&nd, MAY_EXEC | MAY_ACCESS); 520 error = inode_permission(nd.path.dentry->d_inode, MAY_EXEC | MAY_ACCESS);
519 if (error) 521 if (error)
520 goto dput_and_out; 522 goto dput_and_out;
521 523
@@ -544,7 +546,7 @@ asmlinkage long sys_fchdir(unsigned int fd)
544 if (!S_ISDIR(inode->i_mode)) 546 if (!S_ISDIR(inode->i_mode))
545 goto out_putf; 547 goto out_putf;
546 548
547 error = file_permission(file, MAY_EXEC | MAY_ACCESS); 549 error = inode_permission(inode, MAY_EXEC | MAY_ACCESS);
548 if (!error) 550 if (!error)
549 set_fs_pwd(current->fs, &file->f_path); 551 set_fs_pwd(current->fs, &file->f_path);
550out_putf: 552out_putf:
@@ -562,7 +564,7 @@ asmlinkage long sys_chroot(const char __user * filename)
562 if (error) 564 if (error)
563 goto out; 565 goto out;
564 566
565 error = vfs_permission(&nd, MAY_EXEC | MAY_ACCESS); 567 error = inode_permission(nd.path.dentry->d_inode, MAY_EXEC | MAY_ACCESS);
566 if (error) 568 if (error)
567 goto dput_and_out; 569 goto dput_and_out;
568 570