linux-stable/drivers/usb
Andrey Konovalov 45285dba03 usb: raw-gadget: properly handle interrupted requests
commit e8033bde45 upstream.

Currently, if a USB request that was queued by Raw Gadget is interrupted
(via a signal), wait_for_completion_interruptible returns -ERESTARTSYS.
Raw Gadget then attempts to propagate this value to userspace as a return
value from its ioctls. However, when -ERESTARTSYS is returned by a syscall
handler, the kernel internally restarts the syscall.

This doesn't allow userspace applications to interrupt requests queued by
Raw Gadget (which is required when the emulated device is asked to switch
altsettings). It also violates the implied interface of Raw Gadget that a
single ioctl must only queue a single USB request.

Instead, make Raw Gadget do what GadgetFS does: check whether the request
was interrupted (dequeued with status == -ECONNRESET) and report -EINTR to
userspace.

Fixes: f2c2e71764 ("usb: gadget: add raw-gadget interface")
Cc: stable <stable@kernel.org>
Signed-off-by: Andrey Konovalov <andreyknvl@gmail.com>
Link: https://lore.kernel.org/r/0db45b1d7cc466e3d4d1ab353f61d63c977fbbc5.1698350424.git.andreyknvl@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-11-08 11:56:22 +01:00
..
atm
c67x00 usb: c67x00-drv: Convert to platform remove callback returning void 2023-05-28 12:36:14 +01:00
cdns3 usb: cdns3: Modify the return value of cdns_set_active () to void when CONFIG_PM_SLEEP is disabled 2023-10-02 14:25:39 +02:00
chipidea usb: chipidea: add workaround for chipidea PEC bug 2023-08-09 14:16:06 +02:00
class TTY/Serial driver changes for 6.6-rc1 2023-09-01 09:38:00 -07:00
common Merge 6.5-rc6 into usb-next 2023-08-14 22:22:31 +02:00
core usb: hub: Guard against accesses to uninitialized BOS descriptors 2023-10-02 13:51:24 +02:00
dwc2 usb: dwc2: add pci_device_id driver_data parse support 2023-08-22 14:49:12 +02:00
dwc3 usb: dwc3: Soft reset phy on probe for host 2023-10-02 14:04:12 +02:00
early
fotg210 usb: fotg210: Convert to platform remove callback returning void 2023-05-28 12:36:25 +01:00
gadget usb: raw-gadget: properly handle interrupted requests 2023-11-08 11:56:22 +01:00
host xhci: Preserve RsvdP bits in ERSTBA register correctly 2023-10-02 16:33:46 +02:00
image scsi: usb: uas: Declare two host templates and host template pointers const 2023-03-24 19:20:00 -04:00
isp1760 usb: isp1760: Convert to platform remove callback returning void 2023-05-28 12:38:01 +01:00
misc usb: misc: onboard_hub: add support for Microchip USB2412 USB 2.0 hub 2023-10-02 16:15:22 +02:00
mon USB: mon: make mon_bin_class a static const structure 2023-06-20 16:20:45 +02:00
mtu3 usb: Explicitly include correct DT includes 2023-07-25 18:20:02 +02:00
musb usb: musb: Get the musb_qh poniter after musb_giveback 2023-10-02 13:37:57 +02:00
phy usb: phy: mxs: disconnect line when USB charger is attached 2023-07-25 18:24:17 +02:00
renesas_usbhs usb: Explicitly include correct DT includes 2023-07-25 18:20:02 +02:00
roles USB: roles: make role_class a static const structure 2023-06-20 16:20:40 +02:00
serial USB: serial: option: add Fibocom to DELL custom modem FM101R-GL 2023-10-16 10:40:30 +02:00
storage usb: storage: set 1.50 as the lower bcdDevice for older "Super Top" compatibility 2023-11-08 11:56:22 +01:00
typec usb: typec: tcpm: Fix NULL pointer dereference in tcpm_pd_svdm() 2023-11-08 11:56:22 +01:00
usbip USB: usbip: Remove an unnecessary goto 2023-08-08 10:36:51 +02:00
Kconfig usb: move config USB_USS720 to usb's misc Kconfig 2023-03-29 10:34:08 +02:00
Makefile usb: host: u132-hcd: Delete driver 2023-03-21 14:06:11 +01:00
usb-skeleton.c