All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Love <rml@tech9.net>
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: 29 Oct 2001 22:13:55 -0500	[thread overview]
Message-ID: <1004411636.807.262.camel@phantasy> (raw)
In-Reply-To: <1004403868.809.147.camel@phantasy>
In-Reply-To: <1004403868.809.147.camel@phantasy>

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.

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


  reply	other threads:[~2001-10-30  3:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-30  1:04 [PATCH] tty race on con_close and con_flush_chars Robert Love
2001-10-30  3:13 ` Robert Love [this message]
2001-10-31  5:08   ` Tachino Nobuhiro

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=1004411636.807.262.camel@phantasy \
    --to=rml@tech9.net \
    --cc=andrewm@uow.edu.au \
    --cc=laughing@shared-source.org \
    --cc=linus@transmeta.com \
    --cc=linux-kernel@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.