coreboot-kgpe-d16/payloads/libpayload/drivers/usb
Julius Werner 182fea717e libpayload: usbmsc: Skip zero-length packets at end of data
Some broken USB mass storage devices send another zero-length packet at
the end of the data part of a transfer if the amount of data was evenly
divisible by the packet size (which is pretty much always the case for
block reads). This packet will get interpreted as the CSW and screw up
the MSC state machine.

This patch works around this issue by retrying the CSW transfer when it
was received as exactly 0 bytes. This is the same mitigation the Linux
kernel uses and harmless for correctly behaving devices. Also tighten
validation of the CSW a little, making sure we verify the length before
we read any fields and checking the signature in addition to the tag.

Change-Id: I24f183f27b2c4f0142ba6c4b35b490c5798d0d21
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/34485
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2019-08-22 10:36:48 +00:00
..
dwc2.c libpayload/usb: fix DWC2 driver 2019-07-09 13:05:53 +00:00
dwc2.h tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
dwc2_private.h tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
dwc2_rh.c tree: drop last paragraph of GPL copyright header 2015-10-31 21:37:39 +01:00
ehci.c libpayload/usb: Increase USB request timeout to 5 s 2019-07-02 17:42:18 +00:00
ehci.h libpayload: Use unsigned long for BARs in *hci_init() 2014-07-10 20:55:41 +02:00
ehci_private.h Rename __attribute__((packed)) --> __packed 2017-07-13 19:45:59 +00:00
ehci_rh.c payloads: Replace all IS_ENABLED(CONFIG_XXX) with CONFIG(XXX) 2019-03-07 17:15:30 +00:00
generic_hub.c libpayload/generic_hub: Detect port disconnect after reset 2018-07-17 20:38:46 +00:00
generic_hub.h libpayload: usb: Remove generic roothub reset port function 2014-10-02 17:28:47 +02:00
Kconfig libpayload: Reintroduce CONFIG_LP_CHROMEOS to set suitable defaults 2016-10-17 22:46:11 +02:00
ohci.c libpayload/usb: Increase USB request timeout to 5 s 2019-07-02 17:42:18 +00:00
ohci.h libpayload: Use unsigned long for BARs in *hci_init() 2014-07-10 20:55:41 +02:00
ohci_private.h libpayload/drivers/usb/ohci_private.h: Add parentheses around macro 2018-04-29 18:13:08 +00:00
ohci_rh.c libpayload: usb: Fix up usb_shutdown() code paths 2014-11-13 06:22:45 +01:00
quirks.c Remove empty lines at end of file 2015-06-08 00:55:07 +02:00
TODO Since some people disapprove of white space cleanups mixed in regular commits 2010-04-27 06:56:47 +00:00
uhci.c libpayload/usb: Increase USB request timeout to 5 s 2019-07-02 17:42:18 +00:00
uhci.h libpayload: Add USB support for non-PCI controllers 2013-11-25 23:31:52 +01:00
uhci_private.h Rename __attribute__((packed)) --> __packed 2017-07-13 19:45:59 +00:00
uhci_rh.c libpayload: Improve sanity checking in UHCI driver 2015-02-23 21:59:25 +01:00
usb.c payloads: Replace all IS_ENABLED(CONFIG_XXX) with CONFIG(XXX) 2019-03-07 17:15:30 +00:00
usb_dev.c libpayload/drivers/usb: Fix leaks 2018-10-01 16:58:29 +00:00
usbhid.c payloads: Replace all IS_ENABLED(CONFIG_XXX) with CONFIG(XXX) 2019-03-07 17:15:30 +00:00
usbhub.c libpayload: usbhub: Force enumeration of all connected ports on init 2017-03-15 00:54:23 +01:00
usbinit.c payloads: Replace all IS_ENABLED(CONFIG_XXX) with CONFIG(XXX) 2019-03-07 17:15:30 +00:00
usbmsc.c libpayload: usbmsc: Skip zero-length packets at end of data 2019-08-22 10:36:48 +00:00
xhci.c payloads: Replace all IS_ENABLED(CONFIG_XXX) with CONFIG(XXX) 2019-03-07 17:15:30 +00:00
xhci.h libpayload: Use unsigned long for BARs in *hci_init() 2014-07-10 20:55:41 +02:00
xhci_commands.c libpayload: usb: Support MTK xHCI host controller 2015-06-03 11:11:59 +02:00
xhci_debug.c libpayload: usb: Add support for SuperSpeed hubs 2015-07-18 09:40:48 +02:00
xhci_devconf.c payloads: Replace all IS_ENABLED(CONFIG_XXX) with CONFIG(XXX) 2019-03-07 17:15:30 +00:00
xhci_events.c libpayload/usb: Increase USB request timeout to 5 s 2019-07-02 17:42:18 +00:00
xhci_private.h libpayload/xhci: Document struct offsets on xhci_t 2018-07-16 07:43:50 +00:00
xhci_rh.c payloads: Replace all IS_ENABLED(CONFIG_XXX) with CONFIG(XXX) 2019-03-07 17:15:30 +00:00