jiegec / usbip

A Rust library to run a USB/IP server
MIT License
255 stars 25 forks source link

Server wrongly assumes devices are no longer used after unlink command #39

Closed florg-32 closed 5 months ago

florg-32 commented 5 months ago

In the current implementation, the server removes a USB device from its used_device list when it receives USBIP_CMD_UNLINK.

This however leads to issues when multiple URBs are unlinked (wrongly triggers usbip_ret_unlink_fail) or when attempting to submit an URB afterwards (panics on current_import_device.unwrap()). Looking at the USB/IP protocol (3rd diagram) both things should be possible.

h7x4 commented 5 months ago

Hello, thank you for the detailed bug report!

While looking into this, I realize that I have completely misunderstood what USBIP_CMD_UNLINK was supposed to do, as I thought it was a request for graceful shutdown of the connection.

I'll hopefully be able to have a closer look at it in the next few days.