Alan Stern wrote:
> 
> I recently sent in a patch that removes the BKL from usbdev_open:
> 
> http://marc.theaimsgroup.com/?l=linux-usb-devel&m=115074414607596&w=2
> 

ok it seems you did the job for usbdev_open(). But one thing I fail to
understand is:

"""
Yet another problem arises because the same file_operations structure is
accessible through both the /proc/bus/usb/* and /dev/usb/usbdev* file
nodes.  Even when one of them has been removed, it's still possible for
userspace to open the other.  So simple locking around the individual
remove routines is insufficient; we need to lock the entire
usb_notify_remove_device notifier chain.
"""

One other question is does usbdev_remove() really acquire the device
lock ?


> I didn't notice that it was used in usbdev_lseek and there doesn't seem to 
> be any reason for it to be there.  Nor does there seem to be any reason 
> for it in usb_device_lseek.
> 
> The code in usb_device_poll probably should be revised in view of the 
> changes in my patch.  You might want to look at that.  But you're right, 
> it shouldn't be using the BKL.
> 

are we talking about the same thing here ? I was speaking about
usb_device_poll() in devices.c, and it seems you're talking about
usbdev_poll() which is in devio.c.

> Likewise, uhci-debug doesn't need to use the BKL either.  It can simply be 
> removed from that routine.

ok I'll take a look.

> 
> The use of BKL in usb-skeleton and possibly some of the other drivers 
> follows a simple pattern.  It is there to prevent races between open() and 
> disconnect().  The idea is that the kernel automatically acquires the BKL 
> whenever a character device node is opened, so by taking the lock in the 
> disconnect routine we avoid the problem of people opening a device file 
> as it is being unregistered.
> 

can we just use the device's lock for that purpose ?


                Franck

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to