• Timothy Loh's avatar
    Fix crash when switching USB device between VMs · fb114792
    Timothy Loh authored
    This CL fixes a crash that can occur when a USB device shared with a VM
    is shared with a different VM. If the device has not yet been attached,
    e.g. as the first VM is not yet started, we end up in a recursive loop
    between CrosUsbDetector::AttachUsbDeviceToVm(), DetachUsbDeviceFromVm()
    and AttachAfterDetach(), eventually getting a stack overflow.
    
    Bug: b/171265431
    Change-Id: I0ecc28e55160c310473dce3a98f8ada0f99eb3a1
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2485660
    Commit-Queue: Timothy Loh <timloh@chromium.org>
    Commit-Queue: Nicholas Verne <nverne@chromium.org>
    Reviewed-by: default avatarNicholas Verne <nverne@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#819233}
    fb114792
cros_usb_detector.cc 28.9 KB