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, 7 insertions, 2 deletions
diff --git a/kernel/exit.c b/kernel/exit.c
index 88e012ba3..f6e8fb9b1 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -19,6 +19,7 @@
#include <linux/smp.h>
#include <linux/smp_lock.h>
#include <linux/module.h>
+#include <linux/slab.h>
#include <asm/system.h>
#include <asm/uaccess.h>
@@ -367,14 +368,18 @@ static inline void close_files(struct files_struct * files)
if (i >= NR_OPEN)
break;
while (set) {
- if (set & 1)
+ if (set & 1) {
close_fp(files->fd[i]);
+ files->fd[i] = NULL;
+ }
i++;
set >>= 1;
}
}
}
+extern kmem_cache_t *files_cachep;
+
static inline void __exit_files(struct task_struct *tsk)
{
struct files_struct * files = tsk->files;
@@ -383,7 +388,7 @@ static inline void __exit_files(struct task_struct *tsk)
tsk->files = NULL;
if (!--files->count) {
close_files(files);
- kfree(files);
+ kmem_cache_free(files_cachep, files);
}
}
}