aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/sched.h2
-rw-r--r--kernel/fork.c12
-rw-r--r--kernel/signal.c19
3 files changed, 14 insertions, 19 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 7dd430b697aa..921148277da9 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1150,8 +1150,8 @@ extern void exit_thread(void);
1150 1150
1151extern void exit_files(struct task_struct *); 1151extern void exit_files(struct task_struct *);
1152extern void __cleanup_signal(struct signal_struct *); 1152extern void __cleanup_signal(struct signal_struct *);
1153extern void cleanup_sighand(struct task_struct *);
1153extern void __exit_signal(struct task_struct *); 1154extern void __exit_signal(struct task_struct *);
1154extern void __exit_sighand(struct task_struct *);
1155extern void exit_itimers(struct signal_struct *); 1155extern void exit_itimers(struct signal_struct *);
1156 1156
1157extern NORET_TYPE void do_group_exit(int); 1157extern NORET_TYPE void do_group_exit(int);
diff --git a/kernel/fork.c b/kernel/fork.c
index 0aff28cdbadd..12cdd9fc9d02 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -803,6 +803,16 @@ static inline int copy_sighand(unsigned long clone_flags, struct task_struct * t
803 return 0; 803 return 0;
804} 804}
805 805
806void cleanup_sighand(struct task_struct *tsk)
807{
808 struct sighand_struct * sighand = tsk->sighand;
809
810 /* Ok, we're done with the signal handlers */
811 tsk->sighand = NULL;
812 if (atomic_dec_and_test(&sighand->count))
813 kmem_cache_free(sighand_cachep, sighand);
814}
815
806static inline int copy_signal(unsigned long clone_flags, struct task_struct * tsk) 816static inline int copy_signal(unsigned long clone_flags, struct task_struct * tsk)
807{ 817{
808 struct signal_struct *sig; 818 struct signal_struct *sig;
@@ -1224,7 +1234,7 @@ bad_fork_cleanup_mm:
1224bad_fork_cleanup_signal: 1234bad_fork_cleanup_signal:
1225 cleanup_signal(p); 1235 cleanup_signal(p);
1226bad_fork_cleanup_sighand: 1236bad_fork_cleanup_sighand:
1227 __exit_sighand(p); 1237 cleanup_sighand(p);
1228bad_fork_cleanup_fs: 1238bad_fork_cleanup_fs:
1229 exit_fs(p); /* blocking */ 1239 exit_fs(p); /* blocking */
1230bad_fork_cleanup_files: 1240bad_fork_cleanup_files:
diff --git a/kernel/signal.c b/kernel/signal.c
index ca1fa854e469..b29c868bd5ee 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -310,9 +310,7 @@ static void flush_sigqueue(struct sigpending *queue)
310/* 310/*
311 * Flush all pending signals for a task. 311 * Flush all pending signals for a task.
312 */ 312 */
313 313void flush_signals(struct task_struct *t)
314void
315flush_signals(struct task_struct *t)
316{ 314{
317 unsigned long flags; 315 unsigned long flags;
318 316
@@ -326,19 +324,6 @@ flush_signals(struct task_struct *t)
326/* 324/*
327 * This function expects the tasklist_lock write-locked. 325 * This function expects the tasklist_lock write-locked.
328 */ 326 */
329void __exit_sighand(struct task_struct *tsk)
330{
331 struct sighand_struct * sighand = tsk->sighand;
332
333 /* Ok, we're done with the signal handlers */
334 tsk->sighand = NULL;
335 if (atomic_dec_and_test(&sighand->count))
336 kmem_cache_free(sighand_cachep, sighand);
337}
338
339/*
340 * This function expects the tasklist_lock write-locked.
341 */
342void __exit_signal(struct task_struct *tsk) 327void __exit_signal(struct task_struct *tsk)
343{ 328{
344 struct signal_struct *sig = tsk->signal; 329 struct signal_struct *sig = tsk->signal;
@@ -386,7 +371,7 @@ void __exit_signal(struct task_struct *tsk)
386 } 371 }
387 372
388 tsk->signal = NULL; 373 tsk->signal = NULL;
389 __exit_sighand(tsk); 374 cleanup_sighand(tsk);
390 spin_unlock(&sighand->siglock); 375 spin_unlock(&sighand->siglock);
391 rcu_read_unlock(); 376 rcu_read_unlock();
392 377