diff options
author | Kirill Korotaev <dev@sw.ru> | 2006-09-29 05:00:05 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-29 12:18:12 -0400 |
commit | 3b9b8ab65d8eed784b9164d03807cb2bda7b5cd6 (patch) | |
tree | 104c7b01768acd7e152cbf66e4868a73804e8af9 /fs/binfmt_elf.c | |
parent | fc09561d6392771a392dea55c287de7e849b6b63 (diff) |
[PATCH] Fix unserialized task->files changing
Fixed race on put_files_struct on exec with proc. Restoring files on
current on error path may lead to proc having a pointer to already kfree-d
files_struct.
->files changing at exit.c and khtread.c are safe as exit_files() makes all
things under lock.
Found during OpenVZ stress testing.
[akpm@osdl.org: add export]
Signed-off-by: Pavel Emelianov <xemul@openvz.org>
Signed-off-by: Kirill Korotaev <dev@openvz.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/binfmt_elf.c')
-rw-r--r-- | fs/binfmt_elf.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index dfd8cfb7fb5d..bb43da5cde5c 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
@@ -1038,10 +1038,8 @@ out_free_interp: | |||
1038 | out_free_file: | 1038 | out_free_file: |
1039 | sys_close(elf_exec_fileno); | 1039 | sys_close(elf_exec_fileno); |
1040 | out_free_fh: | 1040 | out_free_fh: |
1041 | if (files) { | 1041 | if (files) |
1042 | put_files_struct(current->files); | 1042 | reset_files_struct(current, files); |
1043 | current->files = files; | ||
1044 | } | ||
1045 | out_free_ph: | 1043 | out_free_ph: |
1046 | kfree(elf_phdata); | 1044 | kfree(elf_phdata); |
1047 | goto out; | 1045 | goto out; |