From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: [PATCH 1/6] hfsplus: fix BKL leak in hfsplus_ioctl Date: Sun, 26 Sep 2010 23:19:20 +0200 Message-ID: <20100926211920.GA6394@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org, stable@kernel.org To: viro@zeniv.linux.org.uk, zippel@linux-m68k.org Return-path: Received: from verein.lst.de ([213.95.11.210]:56459 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932151Ab0IZV06 (ORCPT ); Sun, 26 Sep 2010 17:26:58 -0400 Content-Disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Currenly the HFSPLUS_IOC_EXT2_GETFLAGS case never unlocks the BKL, which can lead to easily reproduced lockups when doing multiple GETFLAGS ioctls. Fix this by only taking the BKL for the HFSPLUS_IOC_EXT2_SETFLAGS case as neither HFSPLUS_IOC_EXT2_GETFLAGS not the default error case needs it. This behaviour was introduced by "hfsplus: Push down BKL into ioctl function" during the 2.6.35-rc series. Signed-off-by: Christoph Hellwig Index: linux-2.6/fs/hfsplus/ioctl.c =================================================================== --- linux-2.6.orig/fs/hfsplus/ioctl.c 2010-09-26 01:47:23.992790058 +0900 +++ linux-2.6/fs/hfsplus/ioctl.c 2010-09-26 01:49:16.701790597 +0900 @@ -26,7 +26,6 @@ long hfsplus_ioctl(struct file *filp, un struct inode *inode = filp->f_path.dentry->d_inode; unsigned int flags; - lock_kernel(); switch (cmd) { case HFSPLUS_IOC_EXT2_GETFLAGS: flags = 0; @@ -39,6 +38,8 @@ long hfsplus_ioctl(struct file *filp, un return put_user(flags, (int __user *)arg); case HFSPLUS_IOC_EXT2_SETFLAGS: { int err = 0; + + lock_kernel(); err = mnt_want_write(filp->f_path.mnt); if (err) { unlock_kernel(); @@ -93,7 +94,6 @@ setflags_out: return err; } default: - unlock_kernel(); return -ENOTTY; } }