On 06-06-04 00:25 Oliver Neukum wrote: > > > +static void disconnect(struct usb_interface *intf) > > > This is racy. It allows io to disconnected devices. You must take the > > > lock and set a flag that you test after you've taken the lock elsewhere. > > > > Will fix, thanks. > > You're welcome
Not so fast, because I don't know what to fix. Actually there are two cases, when disconnect is called. The first is, when the device is removed. The second is, when the kernel module is removed from the kernel. It should also be recognized that disconnect() must always succeed, so we have to ignore IO errors anyhow. In the first case we don't need the IO and in the second case we have to do it, because otherwise, the device will not come up, if we load the driver again. Testing shows, that doing the IO doesn't create a lot of issues, there are some errors reported, but that's it and the second case just works fine. So there doesn't appear a problem and even if want to be "clean", I would like to know, how to distinguish both cases without trying to do IO with the device. In the meanwhile I removed the misleading comment about locking. I would like also like to know, that beside the fact that device IO fails, which races can happen? -- Uli Kunitz _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel