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 libpayload: i8042: Enable keyboard translation by default on exit 2021-05-03 15:55:52 +00:00
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 payloads/libpayload: add MTK_TIMER_V2 config 2021-08-09 01:53:20 +00:00
udc payloads: Drop unneeded empty lines 2020-09-21 16:20:57 +00:00
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 payloads: Drop unneeded empty lines 2020-09-21 16:20:57 +00:00
options.c libpayload: use PRIu64 type to print u64 2020-09-30 10:16:44 +00:00
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