On 21/08/13 15:56, Hans de Goede wrote:
> Hi All,
>
> While looking at various locking things in libusb I noticed that
> usbi_get_device_by_session_id iterates over usb_devs while holding
> the usb_devs_lock and then if it finds a device returns that device,
> without taking a reference. This means that potentially the device
> could get free-ed before the caller of usbi_get_device_by_session_id
> is done with it.
>
> I've audited the Linux backends use of usbi_get_device_by_session_id
> and it is safe, but still I think it would be better to make
> usbi_get_device_by_session_id return a ref (and require callers
> to unref when done.
>
> No code yet, just soliciting comments, so please let me know whether
> you think this is a good idea or not.

I think this would be a good idea. When writing the WinCE backend it did 
seem odd to me that it didn't return a device ref and required some 
investigation to check how to use the method safely.

Regards,

Toby


------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel

Reply via email to