aboutsummaryrefslogtreecommitdiffstats
path: root/fs/exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/exec.c')
-rw-r--r--fs/exec.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/fs/exec.c b/fs/exec.c
index ca434534ae9a..8b9011b67041 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -105,7 +105,7 @@ static inline void put_binfmt(struct linux_binfmt * fmt)
105SYSCALL_DEFINE1(uselib, const char __user *, library) 105SYSCALL_DEFINE1(uselib, const char __user *, library)
106{ 106{
107 struct file *file; 107 struct file *file;
108 char *tmp = getname(library); 108 struct filename *tmp = getname(library);
109 int error = PTR_ERR(tmp); 109 int error = PTR_ERR(tmp);
110 static const struct open_flags uselib_flags = { 110 static const struct open_flags uselib_flags = {
111 .open_flag = O_LARGEFILE | O_RDONLY | __FMODE_EXEC, 111 .open_flag = O_LARGEFILE | O_RDONLY | __FMODE_EXEC,
@@ -751,13 +751,14 @@ struct file *open_exec(const char *name)
751{ 751{
752 struct file *file; 752 struct file *file;
753 int err; 753 int err;
754 struct filename tmp = { .name = name };
754 static const struct open_flags open_exec_flags = { 755 static const struct open_flags open_exec_flags = {
755 .open_flag = O_LARGEFILE | O_RDONLY | __FMODE_EXEC, 756 .open_flag = O_LARGEFILE | O_RDONLY | __FMODE_EXEC,
756 .acc_mode = MAY_EXEC | MAY_OPEN, 757 .acc_mode = MAY_EXEC | MAY_OPEN,
757 .intent = LOOKUP_OPEN 758 .intent = LOOKUP_OPEN
758 }; 759 };
759 760
760 file = do_filp_open(AT_FDCWD, name, &open_exec_flags, LOOKUP_FOLLOW); 761 file = do_filp_open(AT_FDCWD, &tmp, &open_exec_flags, LOOKUP_FOLLOW);
761 if (IS_ERR(file)) 762 if (IS_ERR(file))
762 goto out; 763 goto out;
763 764
@@ -1664,10 +1665,10 @@ SYSCALL_DEFINE3(execve,
1664 const char __user *const __user *, argv, 1665 const char __user *const __user *, argv,
1665 const char __user *const __user *, envp) 1666 const char __user *const __user *, envp)
1666{ 1667{
1667 const char *path = getname(filename); 1668 struct filename *path = getname(filename);
1668 int error = PTR_ERR(path); 1669 int error = PTR_ERR(path);
1669 if (!IS_ERR(path)) { 1670 if (!IS_ERR(path)) {
1670 error = do_execve(path, argv, envp, current_pt_regs()); 1671 error = do_execve(path->name, argv, envp, current_pt_regs());
1671 putname(path); 1672 putname(path);
1672 } 1673 }
1673 return error; 1674 return error;
@@ -1677,10 +1678,11 @@ asmlinkage long compat_sys_execve(const char __user * filename,
1677 const compat_uptr_t __user * argv, 1678 const compat_uptr_t __user * argv,
1678 const compat_uptr_t __user * envp) 1679 const compat_uptr_t __user * envp)
1679{ 1680{
1680 const char *path = getname(filename); 1681 struct filename *path = getname(filename);
1681 int error = PTR_ERR(path); 1682 int error = PTR_ERR(path);
1682 if (!IS_ERR(path)) { 1683 if (!IS_ERR(path)) {
1683 error = compat_do_execve(path, argv, envp, current_pt_regs()); 1684 error = compat_do_execve(path->name, argv, envp,
1685 current_pt_regs());
1684 putname(path); 1686 putname(path);
1685 } 1687 }
1686 return error; 1688 return error;