summaryrefslogtreecommitdiffstats
path: root/kernel/exit.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/exit.c')
-rw-r--r--kernel/exit.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/kernel/exit.c b/kernel/exit.c
index fc0799a58..a3d8a7547 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -166,11 +166,9 @@ static inline void close_files(struct files_struct * files)
break;
while (set) {
if (set & 1) {
- struct file * file = files->fd[i];
- if (file) {
- files->fd[i] = NULL;
+ struct file * file = xchg(&files->fd[i], NULL);
+ if (file)
filp_close(file, files);
- }
}
i++;
set >>= 1;
@@ -182,10 +180,9 @@ extern kmem_cache_t *files_cachep;
static inline void __exit_files(struct task_struct *tsk)
{
- struct files_struct * files = tsk->files;
+ struct files_struct * files = xchg(&tsk->files, NULL);
if (files) {
- tsk->files = NULL;
if (atomic_dec_and_test(&files->count)) {
close_files(files);
/*