[PATCH] pid: Properly detect orphaned process groups in exit_notify
authorEric W. Biederman <ebiederm@xmission.com>
Thu, 29 Mar 2007 05:38:16 +0000 (23:38 -0600)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 29 Mar 2007 15:16:23 +0000 (08:16 -0700)
In commit 0475ac0845f9295bc5f69af45f58dff2c104c8d1 when converting the
orphaned process group handling to use struct pid I made a small
mistake.  I accidentally replaced an == with a !=.

Besides just being a dumb thing to do apparently this has a bad side
effect.  The improper orphaned process group detection causes kwin to
die after a suspend/resume cycle.

I'm amazed this patch has been around as long as it has without anyone
else noticing something funny going on.

And the following people deserve credit for spotting and helping
to reproduce this.

Thanks to: Sid Boyce <g3vbv@blueyonder.co.uk>
Thanks to: "Michael Wu"

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/exit.c

index f132349c032569c94d4b3cd710b0c74fe8d0eec5..b55ed4cc91044803a45b74d568d83f9727575b8b 100644 (file)
@@ -790,7 +790,7 @@ static void exit_notify(struct task_struct *tsk)
        
        pgrp = task_pgrp(tsk);
        if ((task_pgrp(t) != pgrp) &&
-           (task_session(t) != task_session(tsk)) &&
+           (task_session(t) == task_session(tsk)) &&
            will_become_orphaned_pgrp(pgrp, tsk) &&
            has_stopped_jobs(pgrp)) {
                __kill_pgrp_info(SIGHUP, SEND_SIG_PRIV, pgrp);