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
..
dwc2.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
dwc2.h treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
dwc2_private.h treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
dwc2_rh.c payloads: Drop unneeded empty lines 2020-09-21 16:20:57 +00:00
ehci.c libpayload/usb: Fix printf format string mismatches in debug messages 2020-11-22 22:34:52 +00:00
ehci.h treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
ehci_private.h treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
ehci_rh.c payloads: Drop unneeded empty lines 2020-09-21 16:20:57 +00:00
generic_hub.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
generic_hub.h treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
Kconfig treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
ohci.c libpayload/usb: Fix printf format string mismatches in debug messages 2020-11-22 22:34:52 +00:00
ohci.h treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
ohci_private.h libpayload: Make OHCI enums into types 2020-11-08 11:37:09 +00:00
ohci_rh.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
quirks.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
TODO
uhci.c libpayload/usb: Fix printf format string mismatches in debug messages 2020-11-22 22:34:52 +00:00
uhci.h treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
uhci_private.h treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
uhci_rh.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
usb.c libpayload/usb: Fix printf format string mismatches in debug messages 2020-11-22 22:34:52 +00:00
usb_dev.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
usbhid.c payloads: Drop unneeded empty lines 2020-09-21 16:20:57 +00:00
usbhub.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
usbinit.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
usbmsc.c libpayload: usbmsc: Prevent usbdisk_remove() from being called twice 2022-08-12 17:14:54 +00:00
xhci.c libpayload/usb: Fix printf format string mismatches in debug messages 2020-11-22 22:34:52 +00:00
xhci.h treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
xhci_commands.c xhci: Do not set the CRCR_CS bit 2020-08-31 06:38:53 +00:00
xhci_debug.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
xhci_devconf.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00
xhci_events.c xhci: Fix Abort command event handling 2020-08-31 06:38:47 +00:00
xhci_private.h payloads: Drop unneeded empty lines 2020-09-21 16:20:57 +00:00
xhci_rh.c payloads: Drop unneeded empty lines 2020-09-21 16:20:57 +00:00