2007-04-23 01:41:36 +00:00
|
|
|
From: Andreas Gruenbacher <agruen@suse.de>
|
|
|
|
Subject: Switch to vfs_permission() in sys_fchdir()
|
|
|
|
|
|
|
|
Switch from file_permission() to vfs_permission() in sys_fchdir(): this
|
2007-04-26 17:09:09 +00:00
|
|
|
avoids calling permission() with a NULL nameidata here.
|
2007-04-23 01:41:36 +00:00
|
|
|
|
|
|
|
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
|
2007-06-26 22:14:37 +00:00
|
|
|
Signed-off-by: John Johansen <jjohansen@suse.de>
|
2007-04-23 01:41:36 +00:00
|
|
|
|
|
|
|
---
|
2008-07-02 20:24:33 +00:00
|
|
|
fs/open.c | 7 +++----
|
|
|
|
1 file changed, 3 insertions(+), 4 deletions(-)
|
2007-04-23 01:41:36 +00:00
|
|
|
|
|
|
|
--- a/fs/open.c
|
|
|
|
+++ b/fs/open.c
|
2008-07-02 20:24:33 +00:00
|
|
|
@@ -512,8 +512,8 @@ out:
|
2007-04-23 01:41:36 +00:00
|
|
|
|
|
|
|
asmlinkage long sys_fchdir(unsigned int fd)
|
|
|
|
{
|
2008-07-02 20:24:33 +00:00
|
|
|
+ struct nameidata nd = { .flags = 0 };
|
2007-04-23 01:41:36 +00:00
|
|
|
struct file *file;
|
|
|
|
- struct inode *inode;
|
|
|
|
int error;
|
|
|
|
|
|
|
|
error = -EBADF;
|
2008-07-02 20:24:33 +00:00
|
|
|
@@ -521,12 +521,11 @@ asmlinkage long sys_fchdir(unsigned int
|
2007-04-23 01:41:36 +00:00
|
|
|
if (!file)
|
|
|
|
goto out;
|
|
|
|
|
2008-07-02 20:24:33 +00:00
|
|
|
- inode = file->f_path.dentry->d_inode;
|
|
|
|
-
|
2007-04-23 01:41:36 +00:00
|
|
|
error = -ENOTDIR;
|
|
|
|
- if (!S_ISDIR(inode->i_mode))
|
2008-07-02 20:24:33 +00:00
|
|
|
+ if (!S_ISDIR(file->f_path.dentry->d_inode->i_mode))
|
2007-04-23 01:41:36 +00:00
|
|
|
goto out_putf;
|
|
|
|
|
2008-07-02 20:24:33 +00:00
|
|
|
+ nd.path = file->f_path;
|
|
|
|
error = file_permission(file, MAY_EXEC);
|
2007-04-23 01:41:36 +00:00
|
|
|
if (!error)
|
2008-07-02 20:24:33 +00:00
|
|
|
set_fs_pwd(current->fs, &file->f_path);
|