diff options
author | Christoph Hellwig <hch@lst.de> | 2010-10-01 05:41:27 +0200 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2010-10-01 05:41:27 +0200 |
commit | 249e6353001e407edf5c9a74482ecfca90c8ff33 (patch) | |
tree | c9f30ff5f686e06cd97fbc891dd90346fc8bc9a7 | |
parent | 0f44fbd297e1cda5d9ecc9f5321a86fe647c7d4a (diff) | |
download | linux-249e6353001e407edf5c9a74482ecfca90c8ff33.tar.bz2 |
hfsplus: fix BKL leak in hfsplus_ioctl
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.
Signed-off-by: Christoph Hellwig <hch@tuxera.com>
-rw-r--r-- | fs/hfsplus/ioctl.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/hfsplus/ioctl.c b/fs/hfsplus/ioctl.c index ac405f099026..59dc402dfe95 100644 --- a/fs/hfsplus/ioctl.c +++ b/fs/hfsplus/ioctl.c @@ -26,7 +26,6 @@ long hfsplus_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) 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, unsigned int cmd, unsigned long arg) 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; } } |