public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] console close race fix resend
@ 2001-12-11  1:51 Robert Love
  2001-12-11  3:16 ` Gordon Oliver
  0 siblings, 1 reply; 6+ messages in thread
From: Robert Love @ 2001-12-11  1:51 UTC (permalink / raw)
  To: marcelo; +Cc: linux-kernel

Marcelo,

[ Resend of previous patch, now against pre8.  Note it (a) is a bug fix
and (b) was in Alan's tree ]

The attached is a fix originally by Andrew Morton and discovered by the
preempt-kernel patch.  It is in Alan's tree but was never merged into
Linus's.

There is a race between con_close and con_flush_chars. 
n_tty_receive_buf writes to the tty queue and then flushes it via
con_flush_chars.  If the console closes in between these operations,
con_flush_char barfs.

Please, for all that is righteous, apply.

	Robert Love

diff -urN linux-2.4.17-pre8/drivers/char/console.c linux/drivers/char/console.c
--- linux-2.4.17-pre8/drivers/char/console.c	Thu Dec  6 14:08:14 2001
+++ linux/drivers/char/console.c	Thu Dec  6 14:09:06 2001
@@ -2356,8 +2356,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();
 }


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2001-12-11  9:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-12-11  1:51 [PATCH] console close race fix resend Robert Love
2001-12-11  3:16 ` Gordon Oliver
2001-12-11  6:05   ` Robert Love
2001-12-11  6:28     ` Andrew Morton
2001-12-11  9:05       ` [PATCH] " Robert Love
2001-12-11  8:54     ` [PATCH] " Gordon Oliver

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox