From: ebiederm@xmission.com (Eric W. Biederman)
To: Hugh Dickins <hugh@veritas.com>
Cc: Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org
Subject: Re: 2.6.21-rc4-mm1: init hangs on tty_mutex
Date: Tue, 20 Mar 2007 15:53:26 -0600 [thread overview]
Message-ID: <m1vegvlgyx.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0703201930060.14654@blonde.wat.veritas.com> (Hugh Dickins's message of "Tue, 20 Mar 2007 19:42:54 +0000 (GMT)")
Hugh Dickins <hugh@veritas.com> writes:
> I get a hang at startup or shutdown: tiocsctty() holds tty_mutex, and
> now with Eric's tty-in-tiocsctty-when-we-steal-a-tty-hang-it-up.patch
> it can end up calling con_close(), which tries to take tty_mutex.
> So best revert that in hot-fixes, until Eric provides a better.
Well I'm confused I know I tested this, and I even added a printk and
saw it trigger a couple of times.
Hmm. Looking at the code it is clearly not safe to hold the tty_mutex
when calling tty_vhangup. I thought the other caller in tty_io.c was doing
that but on a second glance it is clearly not. And the hangup and close
methods do seem to take the tty_mutex.
How this worked in my testing is beyond me..
I will see if I can generate a better patch later.
Acked-by: Eric W. Biederman <ebiederm@xmission.com>
>
> Signed-off-by: Hugh Dickins <hugh@veritas.com>
>
> --- 2.6.21-rc4-mm1/drivers/char/tty_io.c 2007-03-20 12:49:34.000000000 +0000
> +++ linux/drivers/char/tty_io.c 2007-03-20 18:14:53.000000000 +0000
> @@ -2980,7 +2980,9 @@ static int tiocsctty(struct tty_struct *
> /*
> * Steal it away
> */
> - tty_vhangup(tty);
> + read_lock(&tasklist_lock);
> + session_clear_tty(tty->session);
> + read_unlock(&tasklist_lock);
> } else {
> ret = -EPERM;
> goto unlock;
next prev parent reply other threads:[~2007-03-20 21:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-20 19:42 Hugh Dickins
2007-03-20 21:53 ` Eric W. Biederman [this message]
2007-03-21 14:41 ` Hugh Dickins
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m1vegvlgyx.fsf@ebiederm.dsl.xmission.com \
--to=ebiederm@xmission.com \
--cc=akpm@linux-foundation.org \
--cc=hugh@veritas.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®