提交 249e6353 编写于 作者: C Christoph Hellwig

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: NChristoph Hellwig <hch@tuxera.com>
上级 0f44fbd2
...@@ -26,7 +26,6 @@ long hfsplus_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -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; struct inode *inode = filp->f_path.dentry->d_inode;
unsigned int flags; unsigned int flags;
lock_kernel();
switch (cmd) { switch (cmd) {
case HFSPLUS_IOC_EXT2_GETFLAGS: case HFSPLUS_IOC_EXT2_GETFLAGS:
flags = 0; flags = 0;
...@@ -39,6 +38,8 @@ long hfsplus_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -39,6 +38,8 @@ long hfsplus_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
return put_user(flags, (int __user *)arg); return put_user(flags, (int __user *)arg);
case HFSPLUS_IOC_EXT2_SETFLAGS: { case HFSPLUS_IOC_EXT2_SETFLAGS: {
int err = 0; int err = 0;
lock_kernel();
err = mnt_want_write(filp->f_path.mnt); err = mnt_want_write(filp->f_path.mnt);
if (err) { if (err) {
unlock_kernel(); unlock_kernel();
...@@ -93,7 +94,6 @@ long hfsplus_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -93,7 +94,6 @@ long hfsplus_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
return err; return err;
} }
default: default:
unlock_kernel();
return -ENOTTY; return -ENOTTY;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册