diff options
author | Kirill Korotaev <dev@sw.ru> | 2006-09-29 11:00:05 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-29 18:18:12 +0200 |
commit | 3b9b8ab65d8eed784b9164d03807cb2bda7b5cd6 (patch) | |
tree | 104c7b01768acd7e152cbf66e4868a73804e8af9 /fs/exec.c | |
parent | [PATCH] kthread: convert arch/i386/kernel/apm.c (diff) | |
download | linux-3b9b8ab65d8eed784b9164d03807cb2bda7b5cd6.tar.xz linux-3b9b8ab65d8eed784b9164d03807cb2bda7b5cd6.zip |
[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/exec.c')
-rw-r--r-- | fs/exec.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/exec.c b/fs/exec.c index 97df6e0aeaee..a8efe35176b0 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -898,8 +898,7 @@ int flush_old_exec(struct linux_binprm * bprm) return 0; mmap_failed: - put_files_struct(current->files); - current->files = files; + reset_files_struct(current, files); out: return retval; } |