diff options
author | Oliver Neukum <oliver@neukum.org> | 2010-01-13 09:33:43 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-03-02 17:54:24 -0500 |
commit | 01412a219cae5f75ced3aacf1cb56cbe386af9ce (patch) | |
tree | b3e6e8472fdf9ae2659e33d1425517057d8b4050 | |
parent | 86266452f80545285c14e20a8024f79c4fb88a86 (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>
-rw-r--r-- | drivers/usb/core/devio.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index 300f65f681a3..efe82c968366 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, | |||
1719 | 1719 | ||
1720 | if (!(file->f_mode & FMODE_WRITE)) | 1720 | if (!(file->f_mode & FMODE_WRITE)) |
1721 | return -EPERM; | 1721 | return -EPERM; |
1722 | |||
1723 | lock_kernel(); | ||
1722 | usb_lock_device(dev); | 1724 | usb_lock_device(dev); |
1723 | if (!connected(ps)) { | 1725 | if (!connected(ps)) { |
1724 | usb_unlock_device(dev); | 1726 | usb_unlock_device(dev); |
1727 | unlock_kernel(); | ||
1725 | return -ENODEV; | 1728 | return -ENODEV; |
1726 | } | 1729 | } |
1727 | 1730 | ||
@@ -1780,10 +1783,12 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd, | |||
1780 | break; | 1783 | break; |
1781 | 1784 | ||
1782 | case USBDEVFS_SUBMITURB: | 1785 | case USBDEVFS_SUBMITURB: |
1786 | unlock_kernel(); | ||
1783 | snoop(&dev->dev, "%s: SUBMITURB\n", __func__); | 1787 | snoop(&dev->dev, "%s: SUBMITURB\n", __func__); |
1784 | ret = proc_submiturb(ps, p); | 1788 | ret = proc_submiturb(ps, p); |
1785 | if (ret >= 0) | 1789 | if (ret >= 0) |
1786 | inode->i_mtime = CURRENT_TIME; | 1790 | inode->i_mtime = CURRENT_TIME; |
1791 | lock_kernel(); | ||
1787 | break; | 1792 | break; |
1788 | 1793 | ||
1789 | #ifdef CONFIG_COMPAT | 1794 | #ifdef CONFIG_COMPAT |
@@ -1835,13 +1840,17 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd, | |||
1835 | break; | 1840 | break; |
1836 | 1841 | ||
1837 | case USBDEVFS_REAPURB: | 1842 | case USBDEVFS_REAPURB: |
1843 | unlock_kernel(); | ||
1838 | snoop(&dev->dev, "%s: REAPURB\n", __func__); | 1844 | snoop(&dev->dev, "%s: REAPURB\n", __func__); |
1839 | ret = proc_reapurb(ps, p); | 1845 | ret = proc_reapurb(ps, p); |
1846 | lock_kernel(); | ||
1840 | break; | 1847 | break; |
1841 | 1848 | ||
1842 | case USBDEVFS_REAPURBNDELAY: | 1849 | case USBDEVFS_REAPURBNDELAY: |
1850 | unlock_kernel(); | ||
1843 | snoop(&dev->dev, "%s: REAPURBNDELAY\n", __func__); | 1851 | snoop(&dev->dev, "%s: REAPURBNDELAY\n", __func__); |
1844 | ret = proc_reapurbnonblock(ps, p); | 1852 | ret = proc_reapurbnonblock(ps, p); |
1853 | lock_kernel(); | ||
1845 | break; | 1854 | break; |
1846 | 1855 | ||
1847 | case USBDEVFS_DISCSIGNAL: | 1856 | case USBDEVFS_DISCSIGNAL: |
@@ -1875,6 +1884,7 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd, | |||
1875 | break; | 1884 | break; |
1876 | } | 1885 | } |
1877 | usb_unlock_device(dev); | 1886 | usb_unlock_device(dev); |
1887 | unlock_kernel(); | ||
1878 | if (ret >= 0) | 1888 | if (ret >= 0) |
1879 | inode->i_atime = CURRENT_TIME; | 1889 | inode->i_atime = CURRENT_TIME; |
1880 | return ret; | 1890 | return ret; |
@@ -1885,9 +1895,7 @@ static long usbdev_ioctl(struct file *file, unsigned int cmd, | |||
1885 | { | 1895 | { |
1886 | int ret; | 1896 | int ret; |
1887 | 1897 | ||
1888 | lock_kernel(); | ||
1889 | ret = usbdev_do_ioctl(file, cmd, (void __user *)arg); | 1898 | ret = usbdev_do_ioctl(file, cmd, (void __user *)arg); |
1890 | unlock_kernel(); | ||
1891 | 1899 | ||
1892 | return ret; | 1900 | return ret; |
1893 | } | 1901 | } |
@@ -1898,9 +1906,7 @@ static long usbdev_compat_ioctl(struct file *file, unsigned int cmd, | |||
1898 | { | 1906 | { |
1899 | int ret; | 1907 | int ret; |
1900 | 1908 | ||
1901 | lock_kernel(); | ||
1902 | ret = usbdev_do_ioctl(file, cmd, compat_ptr(arg)); | 1909 | ret = usbdev_do_ioctl(file, cmd, compat_ptr(arg)); |
1903 | unlock_kernel(); | ||
1904 | 1910 | ||
1905 | return ret; | 1911 | return ret; |
1906 | } | 1912 | } |