diff --git a/kernel/exit.c b/kernel/exit.c index fd0e067952ab03fc3e188913d6c3e575de6d1862..03e64fe4a14af6b12a1b3638e6d54263a589af47 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -189,21 +189,18 @@ void release_task(struct task_struct * p) int session_of_pgrp(int pgrp) { struct task_struct *p; - int sid = -1; + int sid = 0; read_lock(&tasklist_lock); - do_each_task_pid(pgrp, PIDTYPE_PGID, p) { - if (process_session(p) > 0) { - sid = process_session(p); - goto out; - } - } while_each_task_pid(pgrp, PIDTYPE_PGID, p); - p = find_task_by_pid(pgrp); - if (p) + + p = find_task_by_pid_type(PIDTYPE_PGID, pgrp); + if (p == NULL) + p = find_task_by_pid(pgrp); + if (p != NULL) sid = process_session(p); -out: + read_unlock(&tasklist_lock); - + return sid; }