aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/exit.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/exit.c')
-rw-r--r--kernel/exit.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/kernel/exit.c b/kernel/exit.c
index 39d35935b371..7be283d98983 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -27,6 +27,7 @@
27#include <linux/mempolicy.h> 27#include <linux/mempolicy.h>
28#include <linux/cpuset.h> 28#include <linux/cpuset.h>
29#include <linux/syscalls.h> 29#include <linux/syscalls.h>
30#include <linux/signal.h>
30 31
31#include <asm/uaccess.h> 32#include <asm/uaccess.h>
32#include <asm/unistd.h> 33#include <asm/unistd.h>
@@ -38,6 +39,8 @@ extern struct task_struct *child_reaper;
38 39
39int getrusage(struct task_struct *, int, struct rusage __user *); 40int getrusage(struct task_struct *, int, struct rusage __user *);
40 41
42static void exit_mm(struct task_struct * tsk);
43
41static void __unhash_process(struct task_struct *p) 44static void __unhash_process(struct task_struct *p)
42{ 45{
43 nr_threads--; 46 nr_threads--;
@@ -209,7 +212,7 @@ static inline int has_stopped_jobs(int pgrp)
209} 212}
210 213
211/** 214/**
212 * reparent_to_init() - Reparent the calling kernel thread to the init task. 215 * reparent_to_init - Reparent the calling kernel thread to the init task.
213 * 216 *
214 * If a kernel thread is launched as a result of a system call, or if 217 * If a kernel thread is launched as a result of a system call, or if
215 * it ever exits, it should generally reparent itself to init so that 218 * it ever exits, it should generally reparent itself to init so that
@@ -277,7 +280,7 @@ void set_special_pids(pid_t session, pid_t pgrp)
277 */ 280 */
278int allow_signal(int sig) 281int allow_signal(int sig)
279{ 282{
280 if (sig < 1 || sig > _NSIG) 283 if (!valid_signal(sig) || sig < 1)
281 return -EINVAL; 284 return -EINVAL;
282 285
283 spin_lock_irq(&current->sighand->siglock); 286 spin_lock_irq(&current->sighand->siglock);
@@ -298,7 +301,7 @@ EXPORT_SYMBOL(allow_signal);
298 301
299int disallow_signal(int sig) 302int disallow_signal(int sig)
300{ 303{
301 if (sig < 1 || sig > _NSIG) 304 if (!valid_signal(sig) || sig < 1)
302 return -EINVAL; 305 return -EINVAL;
303 306
304 spin_lock_irq(&current->sighand->siglock); 307 spin_lock_irq(&current->sighand->siglock);
@@ -473,7 +476,7 @@ EXPORT_SYMBOL_GPL(exit_fs);
473 * Turn us into a lazy TLB process if we 476 * Turn us into a lazy TLB process if we
474 * aren't already.. 477 * aren't already..
475 */ 478 */
476void exit_mm(struct task_struct * tsk) 479static void exit_mm(struct task_struct * tsk)
477{ 480{
478 struct mm_struct *mm = tsk->mm; 481 struct mm_struct *mm = tsk->mm;
479 482
@@ -517,8 +520,6 @@ static inline void choose_new_parent(task_t *p, task_t *reaper, task_t *child_re
517 */ 520 */
518 BUG_ON(p == reaper || reaper->exit_state >= EXIT_ZOMBIE); 521 BUG_ON(p == reaper || reaper->exit_state >= EXIT_ZOMBIE);
519 p->real_parent = reaper; 522 p->real_parent = reaper;
520 if (p->parent == p->real_parent)
521 BUG();
522} 523}
523 524
524static inline void reparent_thread(task_t *p, task_t *father, int traced) 525static inline void reparent_thread(task_t *p, task_t *father, int traced)