All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][RESEND 3] disassociate_ctty SMP fix
@ 2003-02-05  0:36 Rik van Riel
  2003-02-05  1:07 ` Rik van Riel
  0 siblings, 1 reply; 7+ messages in thread
From: Rik van Riel @ 2003-02-05  0:36 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel, tytso

Hi,

the following patch, against today's BK tree, fixes a small
SMP race in disassociate_ctty.  This function gets called
from do_exit, without the BKL held.

However, it sets the *tty variable before grabbing the bkl,
then makes decisions on what the variable was set to before
the lock was grabbed, despite the fact that another process
could modify its ->tty pointer in this same function.

please apply,
thank you,

Rik
-- 
Bravely reimplemented by the knights who say "NIH".
http://www.surriel.com/		http://guru.conectiva.com/
Current spamtrap:  <a href=mailto:"october@surriel.com">october@surriel.com</a>


===== drivers/char/tty_io.c 1.50 vs edited =====
--- 1.50/drivers/char/tty_io.c	Sat Dec  7 16:23:16 2002
+++ edited/drivers/char/tty_io.c	Sat Jan 11 11:37:34 2003
@@ -571,7 +571,7 @@
  */
 void disassociate_ctty(int on_exit)
 {
-	struct tty_struct *tty = current->tty;
+	struct tty_struct *tty;
 	struct task_struct *p;
 	struct list_head *l;
 	struct pid *pid;
@@ -579,6 +579,7 @@

 	lock_kernel();

+	tty = current->tty;
 	if (tty) {
 		tty_pgrp = tty->pgrp;
 		if (on_exit && tty->driver.type != TTY_DRIVER_TYPE_PTY)

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

end of thread, other threads:[~2003-02-05 16:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-05  0:36 [PATCH][RESEND 3] disassociate_ctty SMP fix Rik van Riel
2003-02-05  1:07 ` Rik van Riel
2003-02-05  1:51   ` Andrew Morton
2003-02-05  1:58     ` Rik van Riel
2003-02-05  9:51       ` Russell King
2003-02-05 14:51         ` Russell King
2003-02-05 16:49           ` Russell King

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.