linux/drivers/usb/core
Alan Stern e8a72e6293 USB: fix the usbfs flag sanitization for control transfers
commit 665c365a77 upstream.

Commit 7a68d9fb85 ("USB: usbdevfs: sanitize flags more") checks the
transfer flags for URBs submitted from userspace via usbfs.  However,
the check for whether the USBDEVFS_URB_SHORT_NOT_OK flag should be
allowed for a control transfer was added in the wrong place, before
the code has properly determined the direction of the control
transfer.  (Control transfers are special because for them, the
direction is set by the bRequestType byte of the Setup packet rather
than direction bit of the endpoint address.)

This patch moves code which sets up the allow_short flag for control
transfers down after is_in has been set to the correct value.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-and-tested-by: syzbot+24a30223a4b609bb802e@syzkaller.appspotmail.com
Fixes: 7a68d9fb85 ("USB: usbdevfs: sanitize flags more")
CC: Oliver Neukum <oneukum@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
History 2018-12-16 22:09:41 +00:00
..
buffer.c usb: core: buffer: smallest buffer should start at ARCH_DMA_MINALIGN 2015-02-24 10:01:02 +00:00
config.c USB: Accept bulk endpoints with 1024-byte maxpacket 2018-10-21 08:45:53 +01:00
devices.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-02-26 20:16:07 -08:00
devio.c USB: fix the usbfs flag sanitization for control transfers 2018-12-16 22:09:41 +00:00
driver.c USB: fix error handling in usb_driver_claim_interface() 2018-12-16 22:09:23 +00:00
endpoint.c USB: core: be specific about attribute permissions 2013-08-25 15:12:03 -07:00
file.c USB: Proper handling of Race Condition when two USB class drivers try to call init_usb_class simultaneously 2017-08-26 02:14:26 +01:00
generic.c USB:fix USB3 devices behind USB3 hubs not resuming at hibernate thaw 2018-10-21 08:44:58 +01:00
hcd-pci.c usb: Don't die twice if PCI xhci host is not responding in resume 2018-12-16 22:09:07 +00:00
hcd.c USB: Increment wakeup count on remote wakeup. 2018-10-21 08:45:34 +01:00
hub.c usb: core: handle hub C_PORT_OVER_CURRENT condition 2018-11-20 18:05:45 +00:00
hub.h usb: fix hub-port pm_runtime_enable() vs runtime pm transitions 2014-06-17 17:04:39 -07:00
Kconfig usb: common: rename phy-fsm-usb.c to usb-otg-fsm.c 2014-05-27 15:29:44 -07:00
Makefile USB: core: remove CONFIG_USB_DEBUG usage 2013-12-21 16:01:00 -08:00
message.c usb: Avoid use-after-free by flushing endpoints early in usb_set_interface() 2018-12-16 22:09:08 +00:00
notify.c usb: Add export.h for EXPORT_SYMBOL/THIS_MODULE where needed 2011-10-31 19:31:25 -04:00
otg_whitelist.h USB: Add OTG PET device to TPL 2015-02-04 10:58:14 +00:00
port.c usb: fix hub-port pm_runtime_enable() vs runtime pm transitions 2014-06-17 17:04:39 -07:00
quirks.c USB: Add quirk to support DJI CineSSD 2018-12-16 22:09:05 +00:00
sysfs.c USB: core: correct spelling mistakes in comments and warning 2014-01-07 16:17:40 -08:00
urb.c USB: core: replace %p with %pK 2017-09-15 18:29:40 +01:00
usb-acpi.c usb: find internal hub tier mismatch via acpi 2014-05-27 16:38:52 -07:00
usb.c USB: handle NULL config in usb_find_alt_setting() 2018-12-16 22:09:23 +00:00
usb.h usb: core: lpm: set lpm_capable for root hub device 2015-08-11 09:57:41 +01:00