linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6] hfsplus: fix BKL leak in hfsplus_ioctl
@ 2010-09-26 21:19 Christoph Hellwig
  2010-09-26 21:19 ` [PATCH 2/6] hfsplus: split hfsplus_ioctl Christoph Hellwig
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Christoph Hellwig @ 2010-09-26 21:19 UTC (permalink / raw)
  To: viro, zippel; +Cc: linux-fsdevel, stable

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 <hch@tuxera.com>

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;
 	}
 }

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

end of thread, other threads:[~2010-09-26 21:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-26 21:19 [PATCH 1/6] hfsplus: fix BKL leak in hfsplus_ioctl Christoph Hellwig
2010-09-26 21:19 ` [PATCH 2/6] hfsplus: split hfsplus_ioctl Christoph Hellwig
2010-09-26 21:20 ` [PATCH 3/6] hfsplus: protect setflags using i_mutex Christoph Hellwig
2010-09-26 21:20 ` [PATCH 4/6] hfsplus: introduce alloc_mutex Christoph Hellwig
2010-09-26 21:20 ` [PATCH 5/6] hfsplus: use alloc_mutex in hfsplus_sync_fs Christoph Hellwig
2010-09-26 21:20 ` [PATCH 5/6] hfsplus: remove BKL from hfsplus_put_super Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).