From: Tachino Nobuhiro <tachino@open.nm.fujitsu.co.jp>
To: Robert Love <rml@tech9.net>
Cc: linus@transmeta.com, laughing@shared-source.org,
linux-kernel@vger.kernel.org, tytso@thunk.org,
andrewm@uow.edu.au
Subject: Re: [PATCH] tty race on con_close and con_flush_chars
Date: Wed, 31 Oct 2001 14:08:44 +0900 [thread overview]
Message-ID: <y9ls8kgz.wl@nisaaru.dvs.cs.fujitsu.co.jp> (raw)
In-Reply-To: <1004411636.807.262.camel@phantasy>
In-Reply-To: <1004403868.809.147.camel@phantasy> <1004411636.807.262.camel@phantasy>
Hello,
At 29 Oct 2001 22:13:55 -0500,
Robert Love wrote:
>
> Someone pointed out (via private email) that a race can still exist
> between checking that vt is non-zero and acquiring the semaphore,
> especially since we can sleep doing that.
>
> I agree; the following patch should alleviate that race.
Your patch only fixes con_flush_chars(), but the same races exists in
do_con_write() and maybe con_unthrottle(). I think the patch below is
better because the oops would never happen with this patch.
diff -r -u -N linux.org/drivers/char/console.c linux/drivers/char/console.c
--- linux.org/drivers/char/console.c Tue Oct 30 18:55:17 2001
+++ linux/drivers/char/console.c Tue Oct 30 19:07:08 2001
@@ -2424,7 +2424,6 @@
return;
if (tty->count != 1) return;
vcs_make_devfs (MINOR (tty->device) - tty->driver.minor_start, 1);
- tty->driver_data = 0;
}
static void vc_init(unsigned int currcons, unsigned int rows, unsigned int cols, int do_clear)
>
> diff -u linux-2.4.13-ac5/drivers/char/console.c
> linux/drivers/char/console.c
> --- linux-2.4.13-ac5/drivers/char/console.c Mon Oct 29 17:27:19 2001
> +++ linux/drivers/char/console.c Mon Oct 29 22:11:27 2001
> @@ -2387,8 +2387,14 @@
> return;
>
> pm_access(pm_con);
> +
> + /*
> + * If we raced with con_close(), `vt' may be null.
> + * Hence this bandaid. - akpm
> + */
> acquire_console_sem();
> - set_cursor(vt->vc_num);
> + if (vt)
> + set_cursor(vt->vc_num);
> release_console_sem();
> }
>
>
> Robert Love
>
prev parent reply other threads:[~2001-10-31 5:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-30 1:04 Robert Love
2001-10-30 3:13 ` Robert Love
2001-10-31 5:08 ` Tachino Nobuhiro [this message]
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=y9ls8kgz.wl@nisaaru.dvs.cs.fujitsu.co.jp \
--to=tachino@open.nm.fujitsu.co.jp \
--cc=andrewm@uow.edu.au \
--cc=laughing@shared-source.org \
--cc=linus@transmeta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rml@tech9.net \
--cc=tytso@thunk.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®