kernel_samsung_a53x/drivers/usb
Andrey Konovalov 206eaac053 usb: raw-gadget: properly handle interrupted requests
commit e8033bde451eddfb9b1bbd6e2d848c1b5c277222 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: f2c2e717642c ("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>
2024-11-18 10:58:48 +01:00
..
atm Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
c67x00 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cdns3 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
chipidea Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
class Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
common Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
core usb: core: Track SuperSpeed Plus GenXxY 2024-11-08 11:26:12 +01:00
dwc2 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dwc3 Fix clang 16 errors treewide 2024-06-15 16:28:48 -03:00
early Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gadget usb: raw-gadget: properly handle interrupted requests 2024-11-18 10:58:48 +01:00
host xhci: cleanup xhci_hub_control port references 2024-11-08 11:26:12 +01:00
image Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
isp1760 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
misc Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mon Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mtu3 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
musb usb: musb: Modify the "HWVers" register address 2024-11-08 11:25:49 +01:00
notify Import A536BXXSAEXE1 2024-06-15 16:07:28 -03:00
notify_lsi Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
phy Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
renesas_usbhs Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
roles Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
serial USB: serial: option: add Fibocom to DELL custom modem FM101R-GL 2024-11-08 11:26:19 +01:00
storage usb: storage: set 1.50 as the lower bcdDevice for older "Super Top" compatibility 2024-11-18 10:58:47 +01:00
typec usb: typec: altmodes/displayport: Signal hpd low when exiting mode 2024-11-08 11:26:15 +01:00
usbip Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig.variant1 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile.variant1 Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
usb-skeleton.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00