summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Neukum <oliver@neukum.org>2010-01-14 16:23:56 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2010-03-02 14:54:32 -0800
commit2a9d0083f63da961a8cd4fdf9f4e8e6433c36966 (patch)
tree4d537433c54bc38858ab99f762ce079d09c99b25
parent9fd5c675864263e9f0e6bdb2d752bb380b32a01b (diff)
USB: BKL removal from ioctl path of usbfs
Total removal from the ioctl code path except for the outcall to external modules. Locking is ensured by the normal locks of usbfs. Signed-off-by: Oliver Neukum <oliver@neukum.org> Cc: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/usb/core/devio.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index efe82c96836..e59efea9410 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -1636,7 +1636,10 @@ static int proc_ioctl(struct dev_state *ps, struct usbdevfs_ioctl *ctl)
if (driver == NULL || driver->ioctl == NULL) {
retval = -ENOTTY;
} else {
+ /* keep API that guarantees BKL */
+ lock_kernel();
retval = driver->ioctl(intf, ctl->ioctl_code, buf);
+ unlock_kernel();
if (retval == -ENOIOCTLCMD)
retval = -ENOTTY;
}
@@ -1720,11 +1723,9 @@ 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;
}
@@ -1783,12 +1784,10 @@ 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
@@ -1840,17 +1839,13 @@ 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:
@@ -1884,7 +1879,6 @@ 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;