Commit 414ca09c authored by Oliver Neukum's avatar Oliver Neukum Committed by Greg Kroah-Hartman

[PATCH] USB core: cleanup BKL

parent 439683c2
...@@ -1090,12 +1090,10 @@ static int proc_ioctl (struct dev_state *ps, void *arg) ...@@ -1090,12 +1090,10 @@ static int proc_ioctl (struct dev_state *ps, void *arg)
else switch (ctrl.ioctl_code) { else switch (ctrl.ioctl_code) {
/* disconnect kernel driver from interface, leaving it unbound. */ /* disconnect kernel driver from interface, leaving it unbound. */
/* maybe unbound - you get no guarantee it stays unbound */
case USBDEVFS_DISCONNECT: case USBDEVFS_DISCONNECT:
/* this function is voodoo. */ /* this function is misdesigned - retained for compatibility */
/* which function ... usb_device_remove()? lock_kernel();
* FIXME either the module lock (BKL) should be involved
* here too, or the 'default' case below is broken
*/
driver = ifp->driver; driver = ifp->driver;
if (driver) { if (driver) {
dbg ("disconnect '%s' from dev %d interface %d", dbg ("disconnect '%s' from dev %d interface %d",
...@@ -1103,11 +1101,14 @@ static int proc_ioctl (struct dev_state *ps, void *arg) ...@@ -1103,11 +1101,14 @@ static int proc_ioctl (struct dev_state *ps, void *arg)
usb_device_remove(&ifp->dev); usb_device_remove(&ifp->dev);
} else } else
retval = -ENODATA; retval = -ENODATA;
unlock_kernel();
break; break;
/* let kernel drivers try to (re)bind to the interface */ /* let kernel drivers try to (re)bind to the interface */
case USBDEVFS_CONNECT: case USBDEVFS_CONNECT:
lock_kernel();
retval = usb_device_probe (&ifp->dev); retval = usb_device_probe (&ifp->dev);
unlock_kernel();
break; break;
/* talk directly to the interface's driver */ /* talk directly to the interface's driver */
...@@ -1129,11 +1130,10 @@ static int proc_ioctl (struct dev_state *ps, void *arg) ...@@ -1129,11 +1130,10 @@ static int proc_ioctl (struct dev_state *ps, void *arg)
} }
unlock_kernel (); unlock_kernel ();
retval = driver->ioctl (ifp, ctrl.ioctl_code, buf); retval = driver->ioctl (ifp, ctrl.ioctl_code, buf);
if (retval == -ENOIOCTLCMD)
retval = -ENOTTY;
module_put (driver->owner); module_put (driver->owner);
} }
if (retval == -ENOIOCTLCMD)
retval = -ENOTTY;
} }
/* cleanup and return */ /* cleanup and return */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment