Re: [patch]usbled disconnect read race

Alan Stern <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
On Fri, 26 Oct 2007, Oliver Neukum wrote:

> Hi,
> 
> usbled has a race where show methods for attributes in sysfs can
> follow a NULL pointer during disconnect. The correct ordering fixes
> it.

Your comment talks about show methods for attributes, but the patch 
affects lcd_open() and lcd_disconnect().  What's going on?

Furthermore, it's been true for a while that unregistering an attribute 
was synchronized with calls to the show and store methods.  There 
shouldn't be any races between show and disconnect.

In addition, usbcore now protects opens and unregistrations of USB
device nodes with an rwsem.  If the driver's disconnect method
unregisters the device node, when the unregistration call returns you
are guaranteed that all open calls either have already succeeded or
else will fail.

Of course, this mechanism doesn't protect against races between 
regular read/write and disconnect.

Alan Stern


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.