Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 84659
b: refs/heads/master
c: e4cc0a9
h: refs/heads/master
i:
  84657: 9c3dc16
  84655: ba55246
v: v3
  • Loading branch information
Oleg Nesterov authored and Linus Torvalds committed Feb 8, 2008
1 parent 2d63c4d commit a75f8f7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4e021306cff4277764a42065214fc73f2d26be4b
refs/heads/master: e4cc0a9c876d4d4eadaef97a2bff4a199946d202
22 changes: 10 additions & 12 deletions trunk/kernel/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -1045,35 +1045,33 @@ asmlinkage long sys_getsid(pid_t pid)
asmlinkage long sys_setsid(void)
{
struct task_struct *group_leader = current->group_leader;
pid_t session;
struct pid *sid = task_pid(group_leader);
pid_t session = pid_vnr(sid);
int err = -EPERM;

write_lock_irq(&tasklist_lock);

/* Fail if I am already a session leader */
if (group_leader->signal->leader)
goto out;

session = group_leader->pid;
/* Fail if a process group id already exists that equals the
* proposed session id.
/* Fail if a process group id already exists that equals the proposed
* session id.
*
* Don't check if session id == 1 because kernel threads use this
* session id and so the check will always fail and make it so
* init cannot successfully call setsid.
* Don't check if session == 1 because kernel threads and CLONE_NEWPID
* tasks use this session id and so the check will always fail and make
* it so init cannot successfully call setsid.
*/
if (session > 1 && find_task_by_pid_type_ns(PIDTYPE_PGID,
session, &init_pid_ns))
if (session != 1 && pid_task(sid, PIDTYPE_PGID))
goto out;

group_leader->signal->leader = 1;
__set_special_pids(session, session);
__set_special_pids(pid_nr(sid), pid_nr(sid));

spin_lock(&group_leader->sighand->siglock);
group_leader->signal->tty = NULL;
spin_unlock(&group_leader->sighand->siglock);

err = task_pgrp_vnr(group_leader);
err = session;
out:
write_unlock_irq(&tasklist_lock);
return err;
Expand Down

0 comments on commit a75f8f7

Please sign in to comment.