Hi Alan, > Usbfs is full of locking errors. In particular, there's no excuse for it > holding the BKL.
I'm afraid there is. > In this case, the simplest solution is simply to insert a test for > actconfig != NULL before it gets dereferenced. To make certain that > actconfig won't change out from under you, be sure to hold dev->serialize > during that test. No, it is wrong to do that because it may deadlock (the existing use of dev->serialize in releaseintf is wrong because of this): driver_disconnect is called with dev->serialize held and takes ps->devsem, as it must. However almost all routines in devio.c are called with ps->devsem taken, so if they take dev->serialize then they may deadlock with driver_disconnect which holds dev->serialize and is waiting for ps->devsem. > The real problem is that usbfs is trying to unbind a driver after usbcore > has already done so on its behalf. A better fix would be to repair > driver_disconnect() and the USBDEVFS_DISCONNECT case in proc_ioctl() > to make them use the > > test_and_clear_bit(intf, &ps->ifclaimed) > > test as they should. Sure, but that is not enough. In fact the whole thing is a mess. It seems to me that devio.c routines need to be able to take dev->serialize. The only reason for ps->devsem is to protect against disconnect (or being bumped off the interface by releaseintf - in fact they are not protected against this because proc_releaseinterface is called with only down_read(&ps->devsem) and not down_write!). I think the simplest solution is to throw away ps->devsem, optionally convert dev->serialize to a rw semaphore for efficiency reasons (probably doesn't gain you much), and use dev->serialize where ps->devsem was used before. There are a few special cases in devio.c which will need to be tweaked in order for this not to cause deadlocks. Duncan. ------------------------------------------------------- This SF.Net email sponsored by: ApacheCon 2003, 16-19 November in Las Vegas. Learn firsthand the latest developments in Apache, PHP, Perl, XML, Java, MySQL, WebDAV, and more! http://www.apachecon.com/ _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel