Messages in this thread | | | Date | Thu, 7 Jun 2012 09:05:30 +0800 | Subject | Re: [PATCH] fix usb skeleton driver | From | Ming Lei <> |
| |
On Wed, Jun 6, 2012 at 11:05 PM, Stefani Seibold <stefani@seibold.net> wrote: >> >> This one is not needed since we have minor_rwsem(drivers/usb/core/file.c) >> to avoid the race. >> > > The mutex is not for the minor handling, it is for the disconnect(). As
usb_deregister_dev is called by disconnect, and usb_deregister_dev will acquire minor_rwsem, so there is no race between open and disconnect. When skel_open is being called, the minor_rwsem has been held already, so disconnect() will staying on acquiring minor_rwsem.
So sync_mutex is not necessary at all.
> mentioned in the previous posting, there is a race betwenn open() and > connect(). > > Oliver told me that a interface pointer can be already used by an other > driver when the disconnect() was called.
If you mean dev->interface, that is protected by io_mutex already.
Thanks, -- Ming Lei
| |