Duncan Sands wrote:

> races with disconnect.  In usb.c there is the usb_disconnect
> function which first calls driver->disconnect, then only later

Ah ok, you're concerned about the driver ioctl getting called
via usbdevfs. The proc_ioctl interface wasn't added by me,
so I don't know the original intention (Greg K-H? David Brownell?)

You can probably fairly easily guard against it, since you most likely
have to have a function that takes the usb_device * and finds the
corresponding driver internal state. So the driver needs to have
some list of valid usb_device * and their corresponding internal
state *. If you remove the usb_device * on disconnect from that
table, that mapping function can notice that the device no longer
exists and return an error.

It's not elegant, though.

The solution maybe is to call usbdevfs_remove_device earlier...

> Suppose I do an ioctl via usbdevfs after (or even during) the call to

during is not a problem. The ioctl will sleep in down_read until
the disconnect is over, then notice that ps->dev is NULL and
return with -ENODEV.

Tom

_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to