aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2005-01-06 00:40:16 -0800
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-01-06 00:40:16 -0800
commitb9b61107f696e231a04f53f3b2ec135db4f666d8 (patch)
tree645806c59d71ab7177bfa867f67accd4dfca782c /kernel
parent0b064cdf39d4993a7d7651a68adacfa5b7986ac6 (diff)
downloadhistory-b9b61107f696e231a04f53f3b2ec135db4f666d8.tar.gz
[PATCH] First cut at setsid/tty locking
Use the existing "tty_sem" to protect against the process tty changes too.
Diffstat (limited to 'kernel')
-rw-r--r--kernel/exit.c2
-rw-r--r--kernel/sys.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/kernel/exit.c b/kernel/exit.c
index dc7549cd7a5815..54a59c727356ce 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -332,7 +332,9 @@ void daemonize(const char *name, ...)
exit_mm(current);
set_special_pids(1, 1);
+ down(&tty_sem);
current->signal->tty = NULL;
+ up(&tty_sem);
/* Block and flush all signals */
sigfillset(&blocked);
diff --git a/kernel/sys.c b/kernel/sys.c
index 1561c2787cc7cb..b6829cea8e0666 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -1075,6 +1075,7 @@ asmlinkage long sys_setsid(void)
if (!thread_group_leader(current))
return -EINVAL;
+ down(&tty_sem);
write_lock_irq(&tasklist_lock);
pid = find_pid(PIDTYPE_PGID, current->pid);
@@ -1088,6 +1089,7 @@ asmlinkage long sys_setsid(void)
err = process_group(current);
out:
write_unlock_irq(&tasklist_lock);
+ up(&tty_sem);
return err;
}