All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: viro@zeniv.linux.org.uk, zippel@linux-m68k.org
Cc: linux-fsdevel@vger.kernel.org, stable@kernel.org
Subject: [PATCH 1/6] hfsplus: fix BKL leak in hfsplus_ioctl
Date: Sun, 26 Sep 2010 23:19:20 +0200	[thread overview]
Message-ID: <20100926211920.GA6394@lst.de> (raw)

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

             reply	other threads:[~2010-09-26 21:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-26 21:19 Christoph Hellwig [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100926211920.GA6394@lst.de \
    --to=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=stable@kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=zippel@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.