aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/core/devio.c
diff options
context:
space:
mode:
authorOliver Neukum <oliver@neukum.org>2010-01-13 15:33:43 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2010-03-02 14:54:24 -0800
commit01412a219cae5f75ced3aacf1cb56cbe386af9ce (patch)
treeb3e6e8472fdf9ae2659e33d1425517057d8b4050 /drivers/usb/core/devio.c
parent86266452f80545285c14e20a8024f79c4fb88a86 (diff)
USB: Reduce scope of BKL in usb ioctl handling
This pushes BKL down in ioctl handling and drops it for some important ioctls Signed-off-by: Oliver Neukum <oliver@neukum.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/core/devio.c')
-rw-r--r--drivers/usb/core/devio.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index 300f65f681a..efe82c96836 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -1719,9 +1719,12 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
if (!(file->f_mode & FMODE_WRITE))
return -EPERM;
+
+ lock_kernel();
usb_lock_device(dev);
if (!connected(ps)) {
usb_unlock_device(dev);
+ unlock_kernel();
return -ENODEV;
}
@@ -1780,10 +1783,12 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
break;
case USBDEVFS_SUBMITURB:
+ unlock_kernel();
snoop(&dev->dev, "%s: SUBMITURB\n", __func__);
ret = proc_submiturb(ps, p);
if (ret >= 0)
inode->i_mtime = CURRENT_TIME;
+ lock_kernel();
break;
#ifdef CONFIG_COMPAT
@@ -1835,13 +1840,17 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
break;
case USBDEVFS_REAPURB:
+ unlock_kernel();
snoop(&dev->dev, "%s: REAPURB\n", __func__);
ret = proc_reapurb(ps, p);
+ lock_kernel();
break;
case USBDEVFS_REAPURBNDELAY:
+ unlock_kernel();
snoop(&dev->dev, "%s: REAPURBNDELAY\n", __func__);
ret = proc_reapurbnonblock(ps, p);
+ lock_kernel();
break;
case USBDEVFS_DISCSIGNAL:
@@ -1875,6 +1884,7 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
break;
}
usb_unlock_device(dev);
+ unlock_kernel();
if (ret >= 0)
inode->i_atime = CURRENT_TIME;
return ret;
@@ -1885,9 +1895,7 @@ static long usbdev_ioctl(struct file *file, unsigned int cmd,
{
int ret;
- lock_kernel();
ret = usbdev_do_ioctl(file, cmd, (void __user *)arg);
- unlock_kernel();
return ret;
}
@@ -1898,9 +1906,7 @@ static long usbdev_compat_ioctl(struct file *file, unsigned int cmd,
{
int ret;
- lock_kernel();
ret = usbdev_do_ioctl(file, cmd, compat_ptr(arg));
- unlock_kernel();
return ret;
}