From: Andrew Morton <akpm@osdl.org>
To: greg@kroah.com, linux-kernel@vger.kernel.org
Subject: Re: 2.6.5-rc3-mm1
Date: Tue, 30 Mar 2004 18:26:27 -0800 [thread overview]
Message-ID: <20040330182627.0e43f1ae.akpm@osdl.org> (raw)
In-Reply-To: <20040330162850.50a0fad4.akpm@osdl.org>
Andrew Morton <akpm@osdl.org> wrote:
>
> I'm thinking that this can be fixed from the other direction: just before
> release_dev() calls close (dropping BKL), if tty->count==1, make the
> going-away tty ineligible for concurrent lookups. Do that by setting
> tty->driver->ttys[idx] to NULL. Maybe.
Famous last word: Volia!
diff -puN drivers/char/tty_io.c~tty-race-fix-42 drivers/char/tty_io.c
--- 25/drivers/char/tty_io.c~tty-race-fix-42 Tue Mar 30 16:30:55 2004
+++ 25-akpm/drivers/char/tty_io.c Tue Mar 30 16:35:21 2004
@@ -1142,6 +1142,17 @@ static void release_dev(struct file * fi
}
#endif
+ /*
+ * ->close can sleep, and drop the BKL. If this tty is about to
+ * be destroyed we need to prevent other threads from coming in and
+ * grabbing a new ref against the about-to-die tty. Those threads
+ * perform the lookup via tty->driver->ttys[], in init_dev().
+ */
+ if (tty->count == 1) {
+ if (!(tty->driver->flags & TTY_DRIVER_DEVPTS_MEM))
+ tty->driver->ttys[idx] = NULL;
+ }
+
if (tty->driver->close)
tty->driver->close(tty, filp);
next prev parent reply other threads:[~2004-03-31 2:26 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-30 10:34 2.6.5-rc3-mm1 Andrew Morton
2004-03-30 21:56 ` 2.6.5-rc3-mm1 (compile stats) John Cherry
2004-03-31 0:03 ` 2.6.5-rc3-mm1 Greg KH
2004-03-31 0:28 ` 2.6.5-rc3-mm1 Andrew Morton
2004-03-31 2:26 ` Andrew Morton [this message]
2004-03-31 7:25 ` 2.6.5-rc3-mm1 Russell King
2004-03-31 8:51 ` 2.6.5-rc3-mm1 Andrew Morton
2004-03-31 3:36 ` 2.6.5-rc3-mm1 - parse_early_options broken Neil Brown
2004-03-30 20:44 2.6.5-rc3-mm1 Sid Boyce
[not found] ` <1080681249.3547.51.camel@watt.suse.com>
2004-03-30 21:57 ` 2.6.5-rc3-mm1 Sid Boyce
2004-03-30 22:04 ` 2.6.5-rc3-mm1 Chris Mason
2004-03-30 22:50 ` 2.6.5-rc3-mm1 Sid Boyce
2004-03-30 23:22 ` 2.6.5-rc3-mm1 Sid Boyce
2004-03-30 22:52 ` 2.6.5-rc3-mm1 Jason Munro
2004-03-31 5:29 2.6.5-rc3-mm1 Paul Blazejowski
[not found] <1Fylv-df-27@gated-at.bofh.it>
[not found] ` <1FzAR-1qq-5@gated-at.bofh.it>
[not found] ` <1FzAR-1qq-3@gated-at.bofh.it>
2004-03-31 7:30 ` 2.6.5-rc3-mm1 Andi Kleen
2004-03-31 22:47 ` 2.6.5-rc3-mm1 Sid Boyce
[not found] ` <1FzKy-1xG-11@gated-at.bofh.it>
[not found] ` <1FAwU-2gc-11@gated-at.bofh.it>
[not found] ` <1FAQv-2wA-57@gated-at.bofh.it>
2004-03-31 7:34 ` 2.6.5-rc3-mm1 Andi Kleen
2004-03-31 8:29 ` 2.6.5-rc3-mm1 Danny ter Haar
2004-03-31 23:05 ` 2.6.5-rc3-mm1 Sid Boyce
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=20040330182627.0e43f1ae.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=greg@kroah.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®