aboutsummaryrefslogtreecommitdiffstats
path: root/fs/exec.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-09-22 16:27:52 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2013-10-24 23:34:54 -0400
commit72c2d53192004845cbc19cd8a30b3212a9288140 (patch)
tree31fcd924438f03d5aa09d13ffd813fb153da37c3 /fs/exec.c
parent22bd002ee76aa7d7a3393f39d977f6c106153c60 (diff)
file->f_op is never NULL...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/exec.c')
-rw-r--r--fs/exec.c35
1 files changed, 15 insertions, 20 deletions
diff --git a/fs/exec.c b/fs/exec.c
index 8875dd10ae7a..351440fbf1ee 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -106,6 +106,7 @@ static inline void put_binfmt(struct linux_binfmt * fmt)
106 */ 106 */
107SYSCALL_DEFINE1(uselib, const char __user *, library) 107SYSCALL_DEFINE1(uselib, const char __user *, library)
108{ 108{
109 struct linux_binfmt *fmt;
109 struct file *file; 110 struct file *file;
110 struct filename *tmp = getname(library); 111 struct filename *tmp = getname(library);
111 int error = PTR_ERR(tmp); 112 int error = PTR_ERR(tmp);
@@ -136,24 +137,21 @@ SYSCALL_DEFINE1(uselib, const char __user *, library)
136 fsnotify_open(file); 137 fsnotify_open(file);
137 138
138 error = -ENOEXEC; 139 error = -ENOEXEC;
139 if(file->f_op) {
140 struct linux_binfmt * fmt;
141 140
142 read_lock(&binfmt_lock); 141 read_lock(&binfmt_lock);
143 list_for_each_entry(fmt, &formats, lh) { 142 list_for_each_entry(fmt, &formats, lh) {
144 if (!fmt->load_shlib) 143 if (!fmt->load_shlib)
145 continue; 144 continue;
146 if (!try_module_get(fmt->module)) 145 if (!try_module_get(fmt->module))
147 continue; 146 continue;
148 read_unlock(&binfmt_lock);
149 error = fmt->load_shlib(file);
150 read_lock(&binfmt_lock);
151 put_binfmt(fmt);
152 if (error != -ENOEXEC)
153 break;
154 }
155 read_unlock(&binfmt_lock); 147 read_unlock(&binfmt_lock);
148 error = fmt->load_shlib(file);
149 read_lock(&binfmt_lock);
150 put_binfmt(fmt);
151 if (error != -ENOEXEC)
152 break;
156 } 153 }
154 read_unlock(&binfmt_lock);
157exit: 155exit:
158 fput(file); 156 fput(file);
159out: 157out:
@@ -1277,13 +1275,10 @@ static int check_unsafe_exec(struct linux_binprm *bprm)
1277 */ 1275 */
1278int prepare_binprm(struct linux_binprm *bprm) 1276int prepare_binprm(struct linux_binprm *bprm)
1279{ 1277{
1280 umode_t mode; 1278 struct inode *inode = file_inode(bprm->file);
1281 struct inode * inode = file_inode(bprm->file); 1279 umode_t mode = inode->i_mode;
1282 int retval; 1280 int retval;
1283 1281
1284 mode = inode->i_mode;
1285 if (bprm->file->f_op == NULL)
1286 return -EACCES;
1287 1282
1288 /* clear any previous set[ug]id data from a previous binary */ 1283 /* clear any previous set[ug]id data from a previous binary */
1289 bprm->cred->euid = current_euid(); 1284 bprm->cred->euid = current_euid();