Re: [PATCH] kdesu broken

From: Linus Torvalds
Date: Wed Jul 29 2009 - 15:08:19 EST




On Wed, 29 Jul 2009, Alan Cox wrote:
>
> Odds of hitting it minimal however. Or maybe we need a smarter
> tty_ldisc_wait_idle(ld) ?

Just adding the ldisc_mutex around the call sounds like the simplest
solution.

That said, looking at the callers of tty_ldisc_wait_idle(), it looks like
we have other similar problems already in tty_ldisc_release(), which also
calls it without holding the lock, both for the "self" case and then
recursively for o_tty.

Moving the mutex_lock() up a bit in tty_ldisc_release() looks like the
trivial solution, although I suspect there are any deadlock issues there
(ie refs that won't go away because we hold the lock and the thing we are
waiting for needs the lock to release the ldisc!).

So making tty_ldisc_wait_idle() more careful adn work without the lock
would definitely be the safer thing to do. Requiring the lock looks
potentially pretty dangerous.

Linus
--
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/