linux-uconsole/drivers/usb/core
Ingo Rohloff cba6467277 usb: usbfs: Suppress problematic bind and unbind uevents.
[ Upstream commit abb0b3d96a ]

commit 1455cf8dbf ("driver core: emit uevents when device is bound
to a driver") added bind and unbind uevents when a driver is bound or
unbound to a physical device.

For USB devices which are handled via the generic usbfs layer (via
libusb for example), this is problematic:
Each time a user space program calls
   ioctl(usb_fd, USBDEVFS_CLAIMINTERFACE, &usb_intf_nr);
and then later
   ioctl(usb_fd, USBDEVFS_RELEASEINTERFACE, &usb_intf_nr);
The kernel will now produce a bind or unbind event, which does not
really contain any useful information.

This allows a user space program to run a DoS attack against programs
which listen to uevents (in particular systemd/eudev/upowerd):
A malicious user space program just has to call in a tight loop

   ioctl(usb_fd, USBDEVFS_CLAIMINTERFACE, &usb_intf_nr);
   ioctl(usb_fd, USBDEVFS_RELEASEINTERFACE, &usb_intf_nr);

With this loop the malicious user space program floods the kernel and
all programs listening to uevents with tons of bind and unbind
events.

This patch suppresses uevents for ioctls USBDEVFS_CLAIMINTERFACE and
USBDEVFS_RELEASEINTERFACE.

Signed-off-by: Ingo Rohloff <ingo.rohloff@lauterbach.com>
Link: https://lore.kernel.org/r/20191011115518.2801-1-ingo.rohloff@lauterbach.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-31 16:35:16 +01:00
..
buffer.c
config.c USB: Skip endpoints with 0 maxpacket length 2019-11-12 19:21:08 +01:00
devices.c
devio.c usb: usbfs: Suppress problematic bind and unbind uevents. 2019-12-31 16:35:16 +01:00
driver.c USB: core: Fix bug caused by duplicate interface PM usage counter 2019-05-08 07:21:44 +02:00
endpoint.c
file.c USB: core: Fix races in character device registration and deregistraion 2019-08-25 10:47:59 +02:00
generic.c
hcd-pci.c usb: hcd: use managed device resources 2019-09-06 10:22:15 +02:00
hcd.c usb: core: Add PM runtime calls to usb_hcd_platform_shutdown 2019-05-31 06:46:30 -07:00
hub.c usb: Allow USB device to be warm reset in suspended state 2019-12-17 20:34:31 +01:00
hub.h
Kconfig
ledtrig-usbport.c USB: leds: fix regression in usbport led trigger 2019-01-31 08:14:34 +01:00
Makefile
message.c USB: CDC: fix sanity checks in CDC union parser 2019-08-25 10:48:00 +02:00
notify.c
of.c
otg_whitelist.h
phy.c
phy.h
port.c
quirks.c USB: Fix chipmunk-like voice when using Logitech C270 for recording audio. 2019-06-19 08:18:05 +02:00
sysfs.c USB: Add new USB LPM helpers 2019-05-02 09:58:56 +02:00
urb.c usb: core: urb: fix URB structure initialization function 2019-12-17 20:34:41 +01:00
usb-acpi.c
usb.c
usb.h USB: Add new USB LPM helpers 2019-05-02 09:58:56 +02:00