diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-13 01:34:18 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-13 01:34:18 -0500 |
commit | 9bc9ccd7db1c9f043f75380b5a5b94912046a60e (patch) | |
tree | dd0a1b3396ae9414f668b0110cc39d11268ad3ed /fs/exec.c | |
parent | f0230294271f511b41797305b685365a9e569a09 (diff) | |
parent | bdd3536618443809d18868563eeafa63b9d29603 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs updates from Al Viro:
"All kinds of stuff this time around; some more notable parts:
- RCU'd vfsmounts handling
- new primitives for coredump handling
- files_lock is gone
- Bruce's delegations handling series
- exportfs fixes
plus misc stuff all over the place"
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (101 commits)
ecryptfs: ->f_op is never NULL
locks: break delegations on any attribute modification
locks: break delegations on link
locks: break delegations on rename
locks: helper functions for delegation breaking
locks: break delegations on unlink
namei: minor vfs_unlink cleanup
locks: implement delegations
locks: introduce new FL_DELEG lock flag
vfs: take i_mutex on renamed file
vfs: rename I_MUTEX_QUOTA now that it's not used for quotas
vfs: don't use PARENT/CHILD lock classes for non-directories
vfs: pull ext4's double-i_mutex-locking into common code
exportfs: fix quadratic behavior in filehandle lookup
exportfs: better variable name
exportfs: move most of reconnect_path to helper function
exportfs: eliminate unused "noprogress" counter
exportfs: stop retrying once we race with rename/remove
exportfs: clear DISCONNECTED on all parents sooner
exportfs: more detailed comment for path_reconnect
...
Diffstat (limited to 'fs/exec.c')
-rw-r--r-- | fs/exec.c | 35 |
1 files changed, 15 insertions, 20 deletions
@@ -106,6 +106,7 @@ static inline void put_binfmt(struct linux_binfmt * fmt) | |||
106 | */ | 106 | */ |
107 | SYSCALL_DEFINE1(uselib, const char __user *, library) | 107 | SYSCALL_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); | ||
157 | exit: | 155 | exit: |
158 | fput(file); | 156 | fput(file); |
159 | out: | 157 | out: |
@@ -1277,13 +1275,10 @@ static int check_unsafe_exec(struct linux_binprm *bprm) | |||
1277 | */ | 1275 | */ |
1278 | int prepare_binprm(struct linux_binprm *bprm) | 1276 | int 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(); |