coreboot-kgpe-d16/payloads/libpayload/drivers/usb
Yidi Lin 8610dd5022 libpayload: usbmsc: Prevent usbdisk_remove() from being called twice
When removing SD card from USB card reader, the USB MSC stack does
not detach the device immediately. Instead, the USB MSC stack calls
usbdisk_remove() and calls usb_msc_destroy() after several pollings.
It results in usbdisk_remove() being called twice.

Since the usbmsc_inst_t instance is freed after first usbdisk_remove()
call, the second call invokes an invalid usbmsc_inst_t instance and
causes exception in CPU.

This patch prevents usbdisk_remove() from being called twice by setting
usbdisk_created to zero.

BUG=b:239492347
TEST=insert an empty SD card into the USB card reader then remove
     the SD card. AP firmware does not crash.

Change-Id: I0675e9fde3e770d63dd0047928356a204245ef18
Signed-off-by: Yidi Lin <yidilin@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/66449
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2022-08-12 17:14:54 +00:00
..
Kconfig
TODO
dwc2.c
dwc2.h
dwc2_private.h
dwc2_rh.c
ehci.c
ehci.h
ehci_private.h
ehci_rh.c
generic_hub.c
generic_hub.h
ohci.c
ohci.h
ohci_private.h
ohci_rh.c
quirks.c
uhci.c
uhci.h
uhci_private.h
uhci_rh.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
usb.c
usb_dev.c
usbhid.c
usbhub.c
usbinit.c
usbmsc.c
xhci.c
xhci.h
xhci_commands.c
xhci_debug.c
xhci_devconf.c
xhci_events.c
xhci_private.h
xhci_rh.c