android_kernel_samsung_a7y1.../include/linux/usb
Alan Stern 68918000af USB: gadget: Reject endpoints with 0 maxpacket value
commit 54f83b8c8ea9b22082a496deadf90447a326954e upstream.

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>
2020-04-07 09:28:10 +02:00
..
manager
association.h
atmel_usba_udc.h
audio-v2.h
audio.h
c67x00.h
cdc_ncm.h
cdc-wdm.h
cdc.h
ch9.h
chipidea.h
class-dual-role.h
composite.h
ehci_def.h
ehci_pdriver.h
ehci-dbgp.h
ezusb.h
f_accessory.h
f_mtp.h
functionfs.h
g_hid.h
gadget_configfs.h
gadget.h
gpio_vbus.h
hcd.h
input.h
iowarrior.h
irda.h
isp116x.h
isp1301.h
isp1362.h
isp1760.h
m66592.h
msm_hsusb_hw.h
msm_hsusb.h
musb-omap.h
musb-ux500.h
musb.h
net2280.h
of.h
ohci_pdriver.h
otg-fsm.h
otg.h
phy_companion.h
phy.h
quirks.h
r8a66597.h
renesas_usbhs.h
rndis_host.h
samsung_usb_phy.h
samsung_usb.h
serial.h
sl811.h
storage.h
tegra_usb_phy.h
tilegx.h
typec.h
uas.h
ulpi.h
usb_phy_generic.h
usb338x.h
usbnet.h
wusb-wa.h
wusb.h
xhci_pdriver.h