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. v2 patch changes: - introduced reset_files_struct() as Christoph Hellwig suggested Found during OpenVZ stress testing. Signed-Off-By: Pavel Emelianov Signed-Off-By: Kirill Korotaev