From patchwork Fri Jan 29 09:43:23 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Bader X-Patchwork-Id: 43909 X-Patchwork-Delegate: stefan.bader@canonical.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 85C98B7D0D for ; Fri, 29 Jan 2010 20:43:37 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.69) (envelope-from ) id 1NanNt-0006DM-Kd; Fri, 29 Jan 2010 09:43:25 +0000 Received: from adelie.canonical.com ([91.189.90.139]) by chlorine.canonical.com with esmtp (Exim 4.69) (envelope-from ) id 1NanNs-0006DH-Jr for kernel-team@lists.canonical.com; Fri, 29 Jan 2010 09:43:24 +0000 Received: from hutte.canonical.com ([91.189.90.181]) by adelie.canonical.com with esmtp (Exim 4.69 #1 (Debian)) id 1NanNs-00079o-IS for ; Fri, 29 Jan 2010 09:43:24 +0000 Received: from p5b2e72fc.dip.t-dialin.net ([91.46.114.252] helo=canonical.com) by hutte.canonical.com with esmtpsa (TLS-1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1NanNs-0002b3-DM for kernel-team@lists.canonical.com; Fri, 29 Jan 2010 09:43:24 +0000 From: Stefan Bader To: kernel-team@lists.canonical.com Subject: [Karmic] SRU: fnctl: f_modown should call write_lock_irqsave/restore Date: Fri, 29 Jan 2010 10:43:23 +0100 Message-Id: <1264758203-7591-1-git-send-email-stefan.bader@canonical.com> X-Mailer: git-send-email 1.6.3.3 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com SRU Justification: Impact: While we have no real bug reported (at least not one we can simply connect to it) I really would like to have this backported to Karmic. Fix: This has gone into 2.6.32.y (and 2.6.27.y) and moving from a *_irq to a *_irqsave variant can only make things better. Plus we might get patches that expose the problem, too. And then forget to pull this as well. Thoughts? I would create a bug report for it, should we decide it should go in. -Stefan From 0a1c275a44db55b2624652b04d4ed9430e82957b Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 26 Jan 2010 15:04:02 -0800 Subject: [PATCH] fnctl: f_modown should call write_lock_irqsave/restore commit b04da8bfdfbbd79544cab2fadfdc12e87eb01600 upstream. Commit 703625118069f9f8960d356676662d3db5a9d116 exposed that f_modown() should call write_lock_irqsave instead of just write_lock_irq so that because a caller could have a spinlock held and it would not be good to renable interrupts. Cc: Eric W. Biederman Cc: Al Viro Cc: Alan Cox Cc: Tavis Ormandy Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds Signed-off-by: Stefan Bader Acked-by: Tim Gardner --- fs/fcntl.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/fcntl.c b/fs/fcntl.c index 97e01dc..5ef953e 100644 --- a/fs/fcntl.c +++ b/fs/fcntl.c @@ -199,7 +199,9 @@ static int setfl(int fd, struct file * filp, unsigned long arg) static void f_modown(struct file *filp, struct pid *pid, enum pid_type type, int force) { - write_lock_irq(&filp->f_owner.lock); + unsigned long flags; + + write_lock_irqsave(&filp->f_owner.lock, flags); if (force || !filp->f_owner.pid) { put_pid(filp->f_owner.pid); filp->f_owner.pid = get_pid(pid); @@ -211,7 +213,7 @@ static void f_modown(struct file *filp, struct pid *pid, enum pid_type type, filp->f_owner.euid = cred->euid; } } - write_unlock_irq(&filp->f_owner.lock); + write_unlock_irqrestore(&filp->f_owner.lock, flags); } int __f_setown(struct file *filp, struct pid *pid, enum pid_type type,