Skip to content

panic in Windows hotplug handler when usbipd bind/unbind is used #184

@Tiwalun

Description

@Tiwalun

I'm seeing a panic on Windows, when I bind or unbind a device in usbipd.

The panic happens on this unwrap:

Steps to reproduce

  • Start hotplug example
  • Run usbipd bind or usbipd unbind
  • hotplug example panics
Backtrace

``` thread '' (27932) panicked at src\platform\windows_winusb\hotplug.rs:163:14: called `Option::unwrap()` on a `None` value stack backtrace: 0: 0x7ff6610b40e2 - std::backtrace_rs::backtrace::win64::trace at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library\std\src\..\..\backtrace\src\backtrace\win64.rs:85 1: 0x7ff6610b40e2 - std::backtrace_rs::backtrace::trace_unsynchronized at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66 2: 0x7ff6610b40e2 - std::sys::backtrace::_print_fmt at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library\std\src\sys\backtrace.rs:68 3: 0x7ff6610b40e2 - std::sys::backtrace::impl$0::print::impl$0::fmt at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library\std\src\sys\backtrace.rs:38 4: 0x7ff6610bcd21 - core::fmt::write at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library\core\src\fmt\mod.rs:0 5: 0x7ff6610a8c84 - std::io::default_write_fmt at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library\std\src\io\mod.rs:639 6: 0x7ff6610a8c84 - std::io::Write::write_fmt at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library\std\src\io\mod.rs:1994 7: 0x7ff6610ae920 - std::sys::backtrace::BacktraceLock::print at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library\std\src\sys\backtrace.rs:41 8: 0x7ff6610ae920 - std::panicking::default_hook::closure$0 at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library\std\src\panicking.rs:292 9: 0x7ff6610ae738 - std::panicking::default_hook at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library\std\src\panicking.rs:319 10: 0x7ff6610aeb92 - std::panicking::panic_with_hook at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library\std\src\panicking.rs:825 11: 0x7ff6610aea29 - std::panicking::panic_handler::closure$0 at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library\std\src\panicking.rs:691 12: 0x7ff6610acb0f - std::sys::backtrace::__rust_end_short_backtrace at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library\std\src\sys\backtrace.rs:176 13: 0x7ff6610a745e - std::panicking::panic_handler at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library\std\src\panicking.rs:689 14: 0x7ff6610c44ad - core::panicking::panic_fmt at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library\core\src\panicking.rs:80 15: 0x7ff6610c4477 - core::panicking::panic at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library\core\src\panicking.rs:150 16: 0x7ff6610c3fbe - core::option::unwrap_failed at /rustc/01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf/library\core\src\option.rs:2175 17: 0x7ff660df6498 - enum2$ >::unwrap at C:\Users\dboeh\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\option.rs:1016 18: 0x7ff660df6498 - nusb::platform::windows_winusb::hotplug::hotplug_callback at C:\Users\dboeh\Coding\nusb\src\platform\windows_winusb\hotplug.rs:163 19: 0x7ffc6c0b89b1 - CM_Get_DevNode_Registry_Property_ExA 20: 0x7ffc6c0b8734 - CM_Get_DevNode_Registry_Property_ExA 21: 0x7ffc6c0be67d - SwDeviceGetLifetime 22: 0x7ffc6fc55240 - RtlSetThreadSubProcessTag 23: 0x7ffc6fc56291 - RtlSetThreadSubProcessTag 24: 0x7ffc6e69e8d7 - BaseThreadInitThunk 25: 0x7ffc6fc6c40c - RtlUserThreadStart error: process didn't exit successfully: `target\debug\examples\hotplug.exe` (exit code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUN) ```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions