mirror-linux/drivers/usb
Andrey Konovalov 23107989be 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 14:11:03 +01:00
..
atm
c67x00
cdns3 usb: cdnsp: Fixes issue with dequeuing not queued requests 2023-10-19 23:08:58 +02:00
chipidea usb: chipidea: add workaround for chipidea PEC bug 2023-09-23 11:11:07 +02:00
class
common usb: common: usb-conn-gpio: Prevent bailing out if initial role is none 2023-08-16 18:27:24 +02:00
core usb: hub: Guard against accesses to uninitialized BOS descriptors 2023-10-19 23:08:55 +02:00
dwc2 usb: dwc2: Fix some error handling paths 2023-07-19 16:21:49 +02:00
dwc3 usb: dwc3: Soft reset phy on probe for host 2023-10-19 23:08:54 +02:00
early
gadget usb: raw-gadget: properly handle interrupted requests 2023-11-08 14:11:03 +01:00
host usb: xhci: xhci-ring: Use sysdev for mapping bounce buffer 2023-10-19 23:08:54 +02:00
image
isp1760
misc usb: misc: onboard_hub: add support for Microchip USB2412 USB 2.0 hub 2023-10-25 12:03:08 +02:00
mon
mtu3
musb usb: musb: Modify the "HWVers" register address 2023-10-19 23:08:55 +02:00
phy usb: phy: mxs: fix getting wrong state with mxs_phy_is_otg_host() 2023-09-13 09:42:51 +02:00
renesas_usbhs
roles Revert "usb: common: usb-conn-gpio: Set last role to unknown before initial detection" 2023-07-19 16:21:56 +02:00
serial USB: serial: option: add Fibocom to DELL custom modem FM101R-GL 2023-10-25 12:03:14 +02:00
storage usb: storage: set 1.50 as the lower bcdDevice for older "Super Top" compatibility 2023-11-08 14:11:03 +01:00
typec usb: typec: tcpm: Fix NULL pointer dereference in tcpm_pd_svdm() 2023-11-08 14:11:03 +01:00
usbip
Kconfig
Makefile
usb-skeleton.c