Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756540Ab0AWA3r (ORCPT ); Fri, 22 Jan 2010 19:29:47 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756479Ab0AWA3Z (ORCPT ); Fri, 22 Jan 2010 19:29:25 -0500 Received: from kroah.org ([198.145.64.141]:35020 "EHLO coco.kroah.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754711Ab0AWASn (ORCPT ); Fri, 22 Jan 2010 19:18:43 -0500 X-Mailbox-Line: From gregkh@mini.kroah.org Fri Jan 22 16:11:10 2010 Message-Id: <20100123001110.875409458@mini.kroah.org> User-Agent: quilt/0.48-1 Date: Fri, 22 Jan 2010 16:09:49 -0800 From: Greg KH To: linux-kernel@vger.kernel.org, stable@kernel.org Cc: stable-review@kernel.org, torvalds@linux-foundation.org, akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk, "Eric W. Biederman" , Al Viro , Tavis Ormandy , Jeff Dike , Julien Tinnes , Matt Mackall Subject: [05/29] tty: fix race in tty_fasync In-Reply-To: <20100123001145.GA7391@kroah.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1457 Lines: 47 2.6.32-stable review patch. If anyone has any objections, please let us know. ------------------ From: Greg Kroah-Hartman commit 703625118069f9f8960d356676662d3db5a9d116 upstream. We need to keep the lock held over the call to __f_setown() to prevent a PID race. Thanks to Al Viro for pointing out the problem, and to Travis for making us look here in the first place. Cc: Eric W. Biederman Cc: Al Viro Cc: Alan Cox Cc: Linus Torvalds Cc: Tavis Ormandy Cc: Jeff Dike Cc: Julien Tinnes Cc: Matt Mackall Signed-off-by: Greg Kroah-Hartman --- drivers/char/tty_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c @@ -1930,8 +1930,8 @@ static int tty_fasync(int fd, struct fil pid = task_pid(current); type = PIDTYPE_PID; } - spin_unlock_irqrestore(&tty->ctrl_lock, flags); retval = __f_setown(filp, pid, type, 0); + spin_unlock_irqrestore(&tty->ctrl_lock, flags); if (retval) goto out; } else { -- 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/