Am Dienstag, 2. Januar 2007 21:04 schrieb J:
Sorry, I was delayed.
> As I wrote before, the error is that usb-serial
> does not use ref counting consistently because
> it does not count every outstanding pointer.
> Specifically, it does not count pointers in
> serial_table. This means that when
It does count them. kref_init() in probe() does
acquire a reference.
> usb_serial_disconnect calls usb_serial_put,
> ref count will go to 0 and object deleted.
> At the same time (but before call to return_serial)
> serial_open will call usb_serial_get_by_index and
> increment the ref count from 0 to 1
> (which should never happen if ref counting is
> implemented correctly).
>
> Please, tell me is I am wrong.
The problem is that lookup and refcounting is not
atomic. Any refcount scheme has that problem. There's
always a window during which you've detected the 1->0
transition and deletion from the table.
> Another think I wanted to clarify is whether it is
> safe to call serial->type->shutdown after
> usb_serial_disconnect already returned.
> You wrote that it is OK to call usb_kill_urb count,
> but it is not OK to do any IO.
Yes. If it is called after disconnect it must not cause IO on the bus.
> So, if we continue to call serial->type->shutdown
> after disconnect, how can we ensure that client
> serial usb drivers do not call any IO?
> Are there any documented rules for what clients
> are supposed to call and when?
Not that I know of.
> I feel that it would be beneficial to ensure that
> shutdown is always called within disconnect
> to simplify task of client driver writers.
Yes, I concur.
Regards
Oliver
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel