Re: [PATCH] move tty_kref_put() outside of __cleanup_signal()

From: Alan Cox
Date: Thu Mar 18 2010 - 18:47:45 EST


> - tty_kref_put(p->signal->tty);
> p->signal->tty = tty_kref_get(current->signal->tty);

That bit needs commenting clearly or a WARN_ON() that p->signal->tty is
NULL before the get otherwise when the assumption is broken the flaw will
be subtle and hard to find.

> attach_pid(p, PIDTYPE_PGID, task_pgrp(current));
> attach_pid(p, PIDTYPE_SID, task_session(current));
> --- 34-rc1/kernel/exit.c~7_TTY_PUT 2010-03-17 20:05:38.000000000 +0100
> +++ 34-rc1/kernel/exit.c 2010-03-18 22:46:41.000000000 +0100
> @@ -150,6 +150,7 @@ static void __exit_signal(struct task_st
> * see account_group_exec_runtime().
> */
> task_rq_unlock_wait(tsk);
> + tty_kref_put(sig->tty);

and a sig->tty = NULL assignment to trap races might not go amiss here
perhaps ?


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/