Re: [PATCH next] usb: usbfs: Add reset_resume for usbfs

From: Oliver Neukum
Date: Thu Jul 11 2024 - 05:00:23 EST




On 11.07.24 10:43, Hongyu Xie wrote:
During hibernation, usb_resume_interface will set needs_binding to 1 if
the usb_driver has no reset_resume implimentation. The USB interface
will be rebind after usb_resume_complete.

Normally, that's fine. But if a USB interface has a matched kernel
driver, and a userspace driver or application is using this USB
interface through usbfs during hibernation, usbfs will be
detatched with the USB interface after resume. And this USB interface
will be bind with a kernel driver instead of usbfs.

So add reset_resume to fix this.

The device has lost all settings, yet we continue like nothing
changed. That strikes me as a very bad idea. If a device has undergone
a reset user space has not requested, we need to return an error upon
the next interaction.

I am sorry, but this implementation has some fundamental issues.

Regards
Oliver