Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Tue, 4 Feb 2003 19:26:52 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Tue, 4 Feb 2003 19:26:52 -0500 Received: from 4-088.ctame701-1.telepar.net.br ([200.193.162.88]:5285 "EHLO 4-088.ctame701-1.telepar.net.br") by vger.kernel.org with ESMTP id ; Tue, 4 Feb 2003 19:26:51 -0500 Date: Tue, 4 Feb 2003 22:36:05 -0200 (BRST) From: Rik van Riel X-X-Sender: riel@imladris.surriel.com To: Linus Torvalds cc: linux-kernel@vger.kernel.org, "" Subject: [PATCH][RESEND 3] disassociate_ctty SMP fix Message-ID: X-spambait: aardvark@kernelnewbies.org X-spammeplease: aardvark@nl.linux.org MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1379 Lines: 46 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: october@surriel.com ===== 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) - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/