aboutsummaryrefslogtreecommitdiffstats
path: root/fs/binfmt_misc.c
diff options
context:
space:
mode:
authorKirill Korotaev <dev@sw.ru>2006-09-29 05:00:05 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-29 12:18:12 -0400
commit3b9b8ab65d8eed784b9164d03807cb2bda7b5cd6 (patch)
tree104c7b01768acd7e152cbf66e4868a73804e8af9 /fs/binfmt_misc.c
parentfc09561d6392771a392dea55c287de7e849b6b63 (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_misc.c')
-rw-r--r--fs/binfmt_misc.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index 66ba137f8661..1713c48fef54 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -215,10 +215,8 @@ _error:
215 bprm->interp_flags = 0; 215 bprm->interp_flags = 0;
216 bprm->interp_data = 0; 216 bprm->interp_data = 0;
217_unshare: 217_unshare:
218 if (files) { 218 if (files)
219 put_files_struct(current->files); 219 reset_files_struct(current, files);
220 current->files = files;
221 }
222 goto _ret; 220 goto _ret;
223} 221}
224 222