diff options
Diffstat (limited to 'kernel/fork.c')
-rw-r--r-- | kernel/fork.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index 8a46ad52be8f..0aff28cdbadd 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -84,7 +84,7 @@ static kmem_cache_t *task_struct_cachep; | |||
84 | #endif | 84 | #endif |
85 | 85 | ||
86 | /* SLAB cache for signal_struct structures (tsk->signal) */ | 86 | /* SLAB cache for signal_struct structures (tsk->signal) */ |
87 | kmem_cache_t *signal_cachep; | 87 | static kmem_cache_t *signal_cachep; |
88 | 88 | ||
89 | /* SLAB cache for sighand_struct structures (tsk->sighand) */ | 89 | /* SLAB cache for sighand_struct structures (tsk->sighand) */ |
90 | kmem_cache_t *sighand_cachep; | 90 | kmem_cache_t *sighand_cachep; |
@@ -872,6 +872,22 @@ static inline int copy_signal(unsigned long clone_flags, struct task_struct * ts | |||
872 | return 0; | 872 | return 0; |
873 | } | 873 | } |
874 | 874 | ||
875 | void __cleanup_signal(struct signal_struct *sig) | ||
876 | { | ||
877 | exit_thread_group_keys(sig); | ||
878 | kmem_cache_free(signal_cachep, sig); | ||
879 | } | ||
880 | |||
881 | static inline void cleanup_signal(struct task_struct *tsk) | ||
882 | { | ||
883 | struct signal_struct *sig = tsk->signal; | ||
884 | |||
885 | atomic_dec(&sig->live); | ||
886 | |||
887 | if (atomic_dec_and_test(&sig->count)) | ||
888 | __cleanup_signal(sig); | ||
889 | } | ||
890 | |||
875 | static inline void copy_flags(unsigned long clone_flags, struct task_struct *p) | 891 | static inline void copy_flags(unsigned long clone_flags, struct task_struct *p) |
876 | { | 892 | { |
877 | unsigned long new_flags = p->flags; | 893 | unsigned long new_flags = p->flags; |
@@ -1206,10 +1222,9 @@ bad_fork_cleanup_mm: | |||
1206 | if (p->mm) | 1222 | if (p->mm) |
1207 | mmput(p->mm); | 1223 | mmput(p->mm); |
1208 | bad_fork_cleanup_signal: | 1224 | bad_fork_cleanup_signal: |
1209 | exit_signal(p); | 1225 | cleanup_signal(p); |
1210 | bad_fork_cleanup_sighand: | 1226 | bad_fork_cleanup_sighand: |
1211 | if (p->sighand) | 1227 | __exit_sighand(p); |
1212 | __exit_sighand(p); | ||
1213 | bad_fork_cleanup_fs: | 1228 | bad_fork_cleanup_fs: |
1214 | exit_fs(p); /* blocking */ | 1229 | exit_fs(p); /* blocking */ |
1215 | bad_fork_cleanup_files: | 1230 | bad_fork_cleanup_files: |