aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/exec.c14
-rw-r--r--fs/namei.c13
-rw-r--r--include/linux/namei.h1
3 files changed, 10 insertions, 18 deletions
diff --git a/fs/exec.c b/fs/exec.c
index eca58c29eded..9696bbf0f0b1 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -106,11 +106,17 @@ static inline void put_binfmt(struct linux_binfmt * fmt)
106 */ 106 */
107asmlinkage long sys_uselib(const char __user * library) 107asmlinkage long sys_uselib(const char __user * library)
108{ 108{
109 struct file * file; 109 struct file *file;
110 struct nameidata nd; 110 struct nameidata nd;
111 int error; 111 char *tmp = getname(library);
112 112 int error = PTR_ERR(tmp);
113 error = __user_path_lookup_open(library, LOOKUP_FOLLOW, &nd, FMODE_READ|FMODE_EXEC); 113
114 if (!IS_ERR(tmp)) {
115 error = path_lookup_open(AT_FDCWD, tmp,
116 LOOKUP_FOLLOW, &nd,
117 FMODE_READ|FMODE_EXEC);
118 putname(tmp);
119 }
114 if (error) 120 if (error)
115 goto out; 121 goto out;
116 122
diff --git a/fs/namei.c b/fs/namei.c
index 38ceb6e06eba..a7b0a0b80128 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1193,19 +1193,6 @@ static int path_lookup_create(int dfd, const char *name,
1193 nd, open_flags, create_mode); 1193 nd, open_flags, create_mode);
1194} 1194}
1195 1195
1196int __user_path_lookup_open(const char __user *name, unsigned int lookup_flags,
1197 struct nameidata *nd, int open_flags)
1198{
1199 char *tmp = getname(name);
1200 int err = PTR_ERR(tmp);
1201
1202 if (!IS_ERR(tmp)) {
1203 err = __path_lookup_intent_open(AT_FDCWD, tmp, lookup_flags, nd, open_flags, 0);
1204 putname(tmp);
1205 }
1206 return err;
1207}
1208
1209static struct dentry *__lookup_hash(struct qstr *name, 1196static struct dentry *__lookup_hash(struct qstr *name,
1210 struct dentry *base, struct nameidata *nd) 1197 struct dentry *base, struct nameidata *nd)
1211{ 1198{
diff --git a/include/linux/namei.h b/include/linux/namei.h
index 00888ff69504..68f8c3203c89 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -65,7 +65,6 @@ extern int path_lookup(const char *, unsigned, struct nameidata *);
65extern int vfs_path_lookup(struct dentry *, struct vfsmount *, 65extern int vfs_path_lookup(struct dentry *, struct vfsmount *,
66 const char *, unsigned int, struct nameidata *); 66 const char *, unsigned int, struct nameidata *);
67 67
68extern int __user_path_lookup_open(const char __user *, unsigned lookup_flags, struct nameidata *nd, int open_flags);
69extern int path_lookup_open(int dfd, const char *name, unsigned lookup_flags, struct nameidata *, int open_flags); 68extern int path_lookup_open(int dfd, const char *name, unsigned lookup_flags, struct nameidata *, int open_flags);
70extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry, 69extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry,
71 int (*open)(struct inode *, struct file *)); 70 int (*open)(struct inode *, struct file *));