• Reilly Grant's avatar
    Reland "Attach UsbContext to libusb_device(_handle) pointers" · ca944e53
    Reilly Grant authored
    This is a reland of daa348fa
    
    Original change's description:
    > Attach UsbContext to libusb_device(_handle) pointers
    > 
    > This change modifies ScopedLibusbDeviceRef and adds a new class
    > ScopedLibusbDeviceHandle. This now explicitly own a reference to the
    > UsbContext object (which reference counts a libusb_context) in addition
    > to the libusb_device or libusb_device_handle they are wrapping.
    > 
    > This resolves potential use-after-frees possible when posting tasks
    > with a ScopedLibusbDeviceRef since the UsbService the task is being
    > posted to could be destroyed before the task is executed. The
    > libusb_device would then be released after its libusb_context has been
    > destroyed.
    > 
    > This is based on https://crrev.com/c/1131949 after I realized there
    > where additional issues that needed to be addressed.
    > 
    > Bug: 838947
    > Change-Id: Idee02828bf615bd477033e585fffe03cf4d20595
    > Reviewed-on: https://chromium-review.googlesource.com/1145910
    > Reviewed-by: Ken Rockot <rockot@chromium.org>
    > Commit-Queue: Reilly Grant <reillyg@chromium.org>
    > Cr-Commit-Position: refs/heads/master@{#577329}
    
    Bug: 838947
    Change-Id: Ibb916b6dea86f05f0b6d2fdfa2d3b71f8c1e8c66
    Reviewed-on: https://chromium-review.googlesource.com/1158770
    Commit-Queue: Reilly Grant <reillyg@chromium.org>
    Reviewed-by: default avatarMatt Reynolds <mattreynolds@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#581997}
    ca944e53
usb_device_impl.h 2.46 KB