coreboot-kgpe-d16/payloads/libpayload/drivers
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
..
i8042
serial treewide: Unify Google branding 2022-07-04 14:02:26 +00:00
storage libpayload/nvme: Fix controller disablement in (de)init sequence 2022-05-11 12:19:03 +00:00
timer
udc
usb libpayload: usbmsc: Prevent usbdisk_remove() from being called twice 2022-08-12 17:14:54 +00:00
video commonlib/bsd/helpers: Remove redundancy with libpayload defines 2022-03-30 21:21:47 +00:00
Makefile.inc libpayload/pci: Add pci_map_bus function for Qualcomm platform 2022-08-01 18:04:54 +00:00
cbmem_console.c libpayload: cbmem_console: Drop loglevel markers from snapshot 2022-03-04 16:04:10 +00:00
hid.c
mouse_cursor.c
nvram.c
options.c
pci_io_ops.c libpayload/pci: Add support for bus mapping 2022-05-20 02:51:33 +00:00
pci_map_bus_ops.c libpayload/pci: Add support for bus mapping 2022-05-20 02:51:33 +00:00
pci_ops.c libpayload/pci: Add support for bus mapping 2022-05-20 02:51:33 +00:00
pci_qcom.c libpayload/pci: Add pci_map_bus function for Qualcomm platform 2022-08-01 18:04:54 +00:00
pcie_mediatek.c libpayload/pci: Add pci_map_bus function for MediaTek platform 2022-05-20 02:53:35 +00:00
speaker.c