OpenCloudOS-Kernel/drivers/usb/gadget/udc
Alan Stern 54f83b8c8e USB: gadget: Reject endpoints with 0 maxpacket value
Endpoints with a maxpacket length of 0 are probably useless.  They
can't transfer any data, and it's not at all unlikely that a UDC will
crash or hang when trying to handle a non-zero-length usb_request for
such an endpoint.  Indeed, dummy-hcd gets a divide error when trying
to calculate the remainder of a transfer length by the maxpacket
value, as discovered by the syzbot fuzzer.

Currently the gadget core does not check for endpoints having a
maxpacket value of 0.  This patch adds a check to usb_ep_enable(),
preventing such endpoints from being used.

As far as I know, none of the gadget drivers in the kernel tries to
create an endpoint with maxpacket = 0, but until now there has been
nothing to prevent userspace programs under gadgetfs or configfs from
doing it.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-and-tested-by: syzbot+8ab8bf161038a8768553@syzkaller.appspotmail.com
CC: <stable@vger.kernel.org>
Acked-by: Felipe Balbi <balbi@kernel.org>

Link: https://lore.kernel.org/r/Pine.LNX.4.44L0.1910281052370.1485-100000@iolanthe.rowland.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-10-29 09:56:18 +01:00
..
aspeed-vhub USB: Changes for v5.4 merge window 2019-09-02 19:20:57 +02:00
bdc usb: Remove dev_err() usage after platform_get_irq() 2019-07-30 20:29:18 +02:00
Kconfig udc: lpc32xx: fix 64-bit compiler warning 2019-10-04 14:35:19 +02:00
Makefile usb/gadget: Add driver for Aspeed SoC virtual hub 2018-05-15 10:06:53 +03:00
amd5536udc.h USB: gadget: udc: Remove redundant license text 2017-11-07 15:45:02 +01:00
amd5536udc_pci.c USB: gadget: udc: Remove redundant license text 2017-11-07 15:45:02 +01:00
at91_udc.c usb: gadget: at91_udc: Remove unneeded variable 2019-06-18 11:58:29 +03:00
at91_udc.h USB: gadget: udc: Remove redundant license text 2017-11-07 15:45:02 +01:00
atmel_usba_udc.c usb: gadget: udc: atmel: Fix interrupt storm in FIFO mode. 2019-10-27 08:58:45 +02:00
atmel_usba_udc.h usb: gadget: atmel: support USB suspend 2019-05-03 09:13:49 +03:00
bcm63xx_udc.c usb: Remove dev_err() usage after platform_get_irq() 2019-07-30 20:29:18 +02:00
core.c USB: gadget: Reject endpoints with 0 maxpacket value 2019-10-29 09:56:18 +01:00
dummy_hcd.c USB: dummy-hcd: fix power budget for SuperSpeed mode 2019-10-04 11:02:59 +02:00
fotg210-udc.c fotg210-udc: Remove unneeded variable 2019-06-18 11:58:29 +03:00
fotg210.h USB: gadget: udc: Remove redundant license text 2017-11-07 15:45:02 +01:00
fsl_mxc_udc.c headers: separate linux/mod_devicetable.h from linux/platform_device.h 2018-07-07 17:52:26 +02:00
fsl_qe_udc.c USB: gadget: udc: Remove redundant license text 2017-11-07 15:45:02 +01:00
fsl_qe_udc.h USB: gadget: udc: Remove redundant license text 2017-11-07 15:45:02 +01:00
fsl_udc_core.c usb: fsl: Check memory resource before releasing it 2019-10-27 08:58:44 +02:00
fsl_usb2_udc.h USB: gadget: udc: Remove redundant license text 2017-11-07 15:45:02 +01:00
fusb300_udc.c usb: gadget: fusb300_udc: Fix memory leak of fusb300->ep[i] 2019-06-06 13:51:57 +03:00
fusb300_udc.h USB: gadget: udc: Remove redundant license text 2017-11-07 15:45:02 +01:00
goku_udc.c proc: introduce proc_create_single{,_data} 2018-05-16 07:23:35 +02:00
goku_udc.h usb: gadget: udc: change comparison to bitshift when dealing with a mask 2018-03-08 15:12:00 +02:00
gr_udc.c usb: Remove dev_err() usage after platform_get_irq() 2019-07-30 20:29:18 +02:00
gr_udc.h USB: gadget: udc: gr_udc: no need to check return value of debugfs_create functions 2018-05-31 12:54:22 +02:00
lpc32xx_udc.c usb: udc: lpc32xx: fix bad bit shift operation 2019-10-15 20:07:44 +02:00
m66592-udc.c treewide: setup_timer() -> timer_setup() 2017-11-21 15:57:07 -08:00
m66592-udc.h USB: gadget: udc: Remove redundant license text 2017-11-07 15:45:02 +01:00
mv_u3d.h USB: gadget: udc: Remove redundant license text 2017-11-07 15:45:02 +01:00
mv_u3d_core.c USB: gadget: udc: Remove redundant license text 2017-11-07 15:45:02 +01:00
mv_udc.h USB: gadget: udc: Remove redundant license text 2017-11-07 15:45:02 +01:00
mv_udc_core.c usb: gadget: udc: Remove unnecessary parentheses 2018-10-02 10:30:07 +03:00
net2272.c usb: gadget: net2272: remove redundant assignments to pointer 's' 2019-06-18 11:58:29 +03:00
net2272.h USB: gadget: udc: Remove redundant license text 2017-11-07 15:45:02 +01:00
net2280.c usb: gadget: net2280: Add workaround for AB chip Errata 11 2019-08-30 09:27:33 +03:00
net2280.h usb: gadget: net2280: Move all "ll" registers in one structure 2019-08-30 09:14:38 +03:00
omap_udc.c USB: omap_udc: Remove unneeded variable 2019-06-18 11:58:29 +03:00
omap_udc.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pch_udc.c usb: gadget: pch_udc: Use dev_get_drvdata 2019-08-09 08:28:29 +03:00
pxa25x_udc.c USB: gadget: pxa25x: Re-use DEFINE_SHOW_ATTRIBUTE() macro 2018-03-08 15:12:00 +02:00
pxa25x_udc.h USB: gadget: udc: Remove redundant license text 2017-11-07 15:45:02 +01:00
pxa27x_udc.c USB: gadget: udc: pxa27x_udc: no need to check return value of debugfs_create functions 2018-05-31 12:54:22 +02:00
pxa27x_udc.h USB: gadget: udc: pxa27x_udc: no need to check return value of debugfs_create functions 2018-05-31 12:54:22 +02:00
r8a66597-udc.c usb: gadget: r8a66597: Fix a possible sleep-in-atomic-context bugs in r8a66597_queue() 2018-07-17 10:12:51 +03:00
r8a66597-udc.h USB: gadget: udc: Remove redundant license text 2017-11-07 15:45:02 +01:00
renesas_usb3.c usb: gadget: udc: renesas_usb3: Fix __le16 warnings 2019-10-27 08:58:44 +02:00
s3c-hsudc.c usb: Remove dev_err() usage after platform_get_irq() 2019-07-30 20:29:18 +02:00
s3c2410_udc.c USB: gadget: udc: s3c2410_udc: Mark expected switch fall-throughs 2019-08-09 07:55:44 +02:00
s3c2410_udc.h USB: gadget: udc: Remove redundant license text 2017-11-07 15:45:02 +01:00
snps_udc_core.c usb: gadget: udc: reduce indentation 2019-01-28 12:51:30 +02:00
snps_udc_plat.c USB: gadget: udc: Remove redundant license text 2017-11-07 15:45:02 +01:00
trace.c USB: gadget: udc: Remove redundant license text 2017-11-07 15:45:02 +01:00
trace.h gadget event trace : add request pointer 2017-12-11 12:36:49 +02:00
udc-xilinx.c usb: Remove dev_err() usage after platform_get_irq() 2019-07-30 20:29:18 +02:00