summaryrefslogtreecommitdiff
path: root/MdeModulePkg
AgeCommit message (Collapse)AuthorFilesLines
2025-06-26MdeModulePkg: PiSmmIpl: Add check for MM communicate v3 headerKun Qin1-0/+7
This change adds a check to ensure the incoming buffer is correctly using MM communicate v3 header before dereferencing the content. Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2025-06-26MdePkg, MdeModulePkg: ArmFfaLib: Expose FFA_ARGS and ArmCallFfaKun Qin1-35/+1
FFA is a framework that supports various protocols built on top. i.e. memory protocol, which is nothing that can be done through existing interfaces. Instead of requiring protocol authors to check conduit PCD in every implementation, exposing the ArmCallFfa is a unified way to allow other protocols to leverage FFA interfaces. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2025-06-26MdeModulePkg: ArmFfaLib: Add Rx/Tx support for Stmm secure partitionKun Qin4-28/+349
This change adds the support for mapping Rx/Tx buffer through the library constructor. The first mapper will produce an MM protocol instance with Rx/Tx information, which allows subsequent consumers to query the information. Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2025-06-25MdeModulePkg/UefiBootManagerLib: Fix crash when no load options are foundJeff Brasen1-0/+4
Do not attempt to sort the load options when there are none. Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
2025-06-25MdeModulePkg/SmmCore: Modify check for Mm Communicate Buffer without dataINDIA\sachinganesh1-1/+1
Modify communication buffer size check to take into consideration that buffer might not have data. Signed-off-by: Sachin Ganesh <sachinganesh@ami.com>
2025-06-25MdeModulePkg/UfsPassThruDxe: Correct size in UfsHc->FreeBuffer callRyan Wong1-2/+2
UfsHc->FreeBuffer accepts page numbers rather than bytes as its size argument. Fix two positions where wrong size were passed. Signed-off-by: Ryan Wong <colorfulshark@gmail.com>
2025-06-16MdeModulePkg: Add help for Reset menu item, and fix French stringsRebecca Cran2-4/+4
Fix the help string for the Reset menu item, and add it to the UI instead of just repeating the main text. Fix the French translations. Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
2025-06-13MdeModulePkg/DebugSupportDxe: Fix type mismatchesMichael D Kinney1-9/+16
The RegisteredCallback field of IdtEntryTable is used to store the address of functions with different function prototypes depending on the ExceptionType. Add local variables with the correct function prototypes and evaluate the ExceptionType to assign correct local variable to the RegisteredCallback value and use local variable to call the registered callback function with the correct arguments for the ExceptionType. Update declaration of InterruptDistrubutionHub() to use the non-CPU specific EFI_SYSTEM_CONTEXT parameter type instead of the IA32 specific EFI_SYSTEM_CONTEXT_IA32 because this function is used for both IA32 and X64. Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
2025-06-13MdeModulePkg/SpiNorFlashJedecSfdp: Initialize AddressSizeMichael D Kinney1-0/+1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
2025-06-13MdeModulePkg: Refactor MM Services Tables linked in MM Core Perf LibMichael Kubacki5-67/+155
The code used a `MmServicesTableLib` dependency for both the Standalone MM and Traditional MM instances and shared code between those. There is not a readily available `MmServicesTable` lib instance for Traditional SMM (that can link to `PiSmmCore`). To ease integration and prevent creating an instance just for this case, this change uses `SmmServicesTableLib` in the Traditional SMM instance and `MmServicesTableLib` in the Standalone MM instance and moves code as necessary to accommodate this. For general reference, there are two available instances of `MmServicesTableLib`: - MdePkg/MmServicesTableLib - only supports DXE_SMM drivers. - MdePkg/StandaloneMmServicesTableLib - supports both MM drivers and MM cores. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2025-06-12MdeModulePkg: Fix function typosGao Qihang4-6/+6
functin -> function Signed-off-by: Gao Qihang <gaoqihang@loongson.cn>
2025-06-12MdeModulePkg: Fix EFI_SUCCESS typosGao Qihang20-36/+36
EFI_SUCESS -> EFI_SUCCESS EFI_SUCESSS -> EFI_SUCCESS Signed-off-by: Gao Qihang <gaoqihang@loongson.cn>
2025-06-12MdeModulePkg/SpiBus: Free handle buffers after LocateHandleBufferDongyan Qian1-2/+4
Fix memory leaks by adding missing FreePool calls: release SpiHcHandles in SpiBusEntry exit path. REF: https://uefi.org/sites/default/files/resources/UEFI_Spec_Final_2.11.pdf Chapter 7.3.15: "Services - Boot Services.LocateHandleBuffer": It is the caller's responsibility to call the Boot Service.FreePool when the caller no longer requires the contents of Buffer. Signed-off-by: Dongyan Qian <qiandongyan@loongson.cn>
2025-06-11MdeModulePkg: Fix definition typosDongyan Qian5-5/+5
`defintion`->`definition` Signed-off-by: Dongyan Qian <qiandongyan@loongson.cn>
2025-06-09MdeModulePkg/HiiDatabaseDxe: Fix NULL Pointer access from EfiVarStoreDeepakX Singh1-0/+5
Issue : When user access "Boot Maintenance Manager Menu/Secure Boot Configuration Menu" with PcdNullPointerDetectionPropertyMask|0x03 and PcdHeapGuardPageType|0x7FFF protection policy set, we get X64 Exception Type - 0E(#PF - Page-Fault) Root cause : When user access "Boot Maintenance Manager Menu/Secure Boot Configuration Menu", BIOS calls FindQuestionDefaultSetting function and send EFI VarStore header pointer to AuthFindVariableData function. When header pointer is NULL, it send NULL pointer to AuthFindVariableData function and causes the page fault. Fix : Database.c: In function FindQuestionDefaultSetting, added NULL pointers check, so that when EFI VarStore header argument is passed to AuthFindVariableData function, NULL pointer access will not happen. Test: Cross verified while accessing the "Boot Maintenance Manager Menu/ Secure Boot Configuration Menu" page. Signed-off-by: DeepakX Singh <deepakx.singh@intel.com>
2025-06-08MdeModulePkg: Prevent memcpy intrinsics in VS22 (17.14.2)Michael Kubacki1-5/+3
The latest VS2022 update replaces some code patterns with struct assignments with `memcpy`. This change convert the code to explicitly use `CopyMem`. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2025-06-07MdeModule: Update oniguruma to v6.9.10Rebecca Cran1-0/+0
Update MdeModulePkg/Universal/RegularExpressionDxe/oniguruma to the last upstream version, v6.9.10. Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
2025-06-05MdeModulePkg: ArmFfaLib: Support UUID-GUID conversion interfacesKun Qin1-45/+2
This change moves the existing ConvertEfiGuidToUuid function to public interface to support newly defined functions prototypes. This change also adds the `ArmConvertUuidToEfiGuid` function implementation, which is an inverse of the original conversion. Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2025-06-05MdeModulePkg/TpmMeasurementLibNull: Allow broader linkingMichael Kubacki2-2/+5
This is needed in a MM_CORE_STANDALONE module. Since this null instance is so simple, remove individual module types to allow it be integrated more easily. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2025-06-05MdeModulePkg/PciBusDxe: Free descriptor buffer in GetResourcePadding()Bret Barkelew3-14/+19
- Updated the PciGetBusRange function signature to use IN OUT for the Descriptors parameter. - Introduced a new DescriptorsBuffer variable in PciLib.c to temporarily hold descriptor data. - Clean up DescriptorsBuffer and set Descriptors to NULL after use. Co-authored-by: Michael Kubacki <michael.kubacki@microsoft.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2025-05-29MdeModulePkg: Typedef ptrdiff_t to fix building with gcc 15.1Rebecca Cran1-0/+1
When building with gcc 15.1, building RegularExpressionDxe fails because it can't find the type ptrdiff_t. Therefore, add a typedef for it in OniguramaUefiPort.h. Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
2025-05-28MdeModulePkg: Enable PciBus to handle CRS responses by ignoring the device.Michael Turner1-12/+23
If there is a slow device on the PCI Bus, and the HostBridge is programmed to allow CRS, the slow device may return 0x0001 to inform the config space reader of the Vendor Id that pci device is not ready. The current PciBus enumerator will treat 0001 as a valid Vendor Id, but it is not. It indicates that all other config space is invalid. This code changes that operation to skip slow devices. PCI EXPRESS BASE SPECIFICATION, REV. 3.1 section 2.3.1 Request Handling Rules. Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
2025-05-28MdeModulePkg/Library: make ArmFfaPeiLib available early PEIM stageLevi Yun2-5/+98
commit 26fb5edff397 ("MdeModulePkg/ArmFfaLib: Add depex on gEfiPeiMemoryDiscoveredPpiGuid") restricts ArmFfaPeiLib usage only after PEI phase can be used permanent memory. However, This would be problem for PEIM which runs before gEfiPeiMemoryDiscoveredPpiGuid Ppi installed. (i.e) Tcg2Pei PEIM. To resolve this, remove dependency on gEfiPeiMemoryDiscoveredPpiGuid and let ArmFfaPeiLib remap the Rx/Tx buffer after gEfiPeiMemoryDiscoveredPpiGuid is installed so that ArmFfaPeiLib can be used with temporary memory. Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com> Fixes: 26fb5edff397 ("MdeModulePkg/ArmFfaLib: ...")
2025-05-28MdeModulePkg: Removed Pei, Dxe, Smm and mm header filesBhavani Subramanian1-4/+0
Signed-off-by: Bhavani Subramanian <v-bhavanisu@microsoft.com>
2025-05-28MdeModulePkg: Added MockHiiLibBhavani Subramanian4-0/+444
Signed-off-by: Bhavani Subramanian <v-bhavanisu@microsoft.com>
2025-05-26MdeModulePkg/Spi: Allow NULL WriteBuffer in FillWriteBuffer()PaddyDeng1-2/+2
Fix false positive assert added in #10924 Functon `FillWriteBuffer()` should able to accept NULL WriteBuffer when WriteBytes equals 0. Use case: ``` // Read Status register TransactionBufferLength = FillWriteBuffer ( Instance, SPI_FLASH_RDSR, SPI_FLASH_RDSR_DUMMY, SPI_FLASH_RDSR_ADDR_BYTES, FALSE, 0, 0, // WriteBytes = 0 NULL // WriteBuffer can be NULL ); ``` Signed-off-by: Paddy Deng <v-paddydeng@microsoft.com>
2025-05-26MdeModulePkg: Fix typos in Protocol/DisplayProtocol.hGao Qihang1-1/+1
`diemenstion`->`dimension` Signed-off-by: Gao Qihang <gaoqihang@loongson.cn>
2025-05-26MdeModulePkg: Fix typos in CustomizedDisplayLibGao Qihang3-5/+5
`diemenstion/diemension`->`dimension` Signed-off-by: Gao Qihang <gaoqihang@loongson.cn>
2025-05-26MdeModulePkg-SdMmcPciHcDxe: Add missing defines in SD_MMC_HC_SLOT_CAPPage Chen2-5/+15
Add missing bit defines from 2.2.26 Capabilities Register (Cat.C Offset 040h) Signed-off-by: Page Chen <paiching_chen@apple.com>
2025-05-16MdeModulePkg/HiiDatabaseDxe: Fix BlockSize lengthMaximilian Brune1-1/+1
The BlockSize calculation was missing the 0 terminator which caused the string block to shrink by 1 every time the string was processed. Therefore causing memory corruptions, because the string took more memory space as was allocated for the string block therefore corrupting the memory pool at the end (which caused an ASSERT upon trying to free it). Signed-off-by: Maximilian Brune <maximilian.brune@9elements.com>
2025-05-09MdeModulePkg: Correct Usb Mouse Z for absolute pointer.Bret Barkelew1-1/+1
https://www.usb.org/sites/default/files/hid1_11.pdf Appendix B, B.2 Protocol 2 (Mouse) details the information returned by a usb mouse HID. bytes 3..n are specific to the device, but are used by absolute pointer devices to return a z axis. Prior to this change, the existing code was reusing the X value for the Z axis, which was incorrect. For usb devices which do not return enough data for a z axis, this change will be a no-op. Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
2025-05-07MdeModulePkg: DebugImageInfoTable: Fix Array MaintenanceOliver Smith-Denny1-18/+9
The DebugImageInfoTable contains an array of image info structures. The current implementation removes an entry by freeing the info structure and putting NULL in that entry of the array. It then decrements the table size tracked in the table. However, the array is invalid at this point, it contains a NULL entry, which the UEFI spec does not envision and it contains a valid entry past the end of the array as tracked in the spec defined config table. If the table is consumed at this point it can lead to an invalid assessment of the image state, which defeats the purpose of the table. When a new info structure is added, it then scans for the first NULL entry adds a pointer to the new info structure there and increments the table size to cover the entrythat was formerly past the end of the array. The current implementation requires that once an unload happens, more loads happen than unloads and that the last operation is not an unload (which won't be true in the shell, e.g.). This is needlessly complex, as the order of the table doesn't matter (and in fact this implementation doesn't preserve image loading order either). This patch updates the removal function to free the desired info structure, move the last entry of the array to this freed spot, mark the last entry as NULL, and decrement the table count. The entry addition function then just always puts a new entry at the end of the array, expanding it as necessary. This simplifies the logic and covers the gaps that were present. Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2025-05-07MdeModulePkg: Fix Image Memory Protection ApplyingOliver Smith-Denny1-8/+13
Commit 5ccb5fff02a66b21898bd57f48bbd7c3cd6f4e8d updated the image memory protection code to set the protection attributes through the GCD instead of directly to the page table. However, this code had an implicit assumption that each base address passed to it was the beginning of a GCD descriptor. On the virtual platforms tested, this was the case. However, on a physical platform, a scenario was encountered where the base address was not the beginning of a GCD descriptor, thus causing memory attributes to be applied incorrectly. This assumption does not need to be made and this patch updates the code to handle the case where the base address is not the beginning of a GCD descriptor. Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2025-05-05MdeModulePkg: Shortcircuit GCD Dumping Logic if Not PrintingOliver Smith-Denny1-0/+14
CoreDumpGcdMemorySpaceMap() gets called on every update to the GCD, but it only prints if DEBUG_GCD is set. However, the compiler is not smart enough to remove all of this logic if we are not printing anything, so we end up needlessly allocating memory for the copy of the map and spending many cycles looping through each entry, only to not print anything. This code is compiled out on release builds, but slows down debug builds that aren't printing at DEBUG_GCD level. This patch updates CoreDumpGcdMemorySpaceMap() to shortcircuit and immediately exit if DEBUG_GCD is not set. It also adds the same logic to CoreDumpGcdIoSpaceMap(), which is called less frequently, but has the same issue. Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2025-05-05MdeModulePkg/Spi: Solving potential null ptr deref. in SpiNorFlashJedecSfdpPaddyDeng1-1/+11
The pointer `Instance->SfdpBasicFlash` can be used before initializing. Example code flow: - CreateSpiNorFlashSfdpInstance: Allocate pool for `Instance` - InitialSpiNorFlashSfdpInstance - ReadSfdp - ReadSfdpHeader - FillWriteBuffer: Dereferencing `Instance->SfdpBasicFlash` - ReadSfdpBasicParameterTable: Allocate pool for `Instance->SfdpBasicFlash` Check both `Instance` and `Instance->SfdpBasicFlash` should have a non null value before dereferencing it. Otherwise use the defaut value 0. Also terminate the function if `Instance` or `WriteBuffer` is NULL. Signed-off-by: Paddy Deng <v-paddydeng@microsoft.com>
2025-05-02MdeModulePkg/AcpiTableDxe: Add function for extract ACPI table from HOB.George Liao1-45/+165
1. Got RSDP table which installed during the FSP phase from Hob, then pass it to the DXE AcpiTableInstance. 2. Got XSDT from RSDP and extract necessary data from XSDT, according to the old XSDT to Initialize a new XSDT. 3. Re-install ACPI table from old XSDT to the new XSDT. a. If Hob has DSDT table then re-install DSDT table in the new XSDT. If not, then skip it. b. If Hob has FACS table then re-install FACS table in the new XSDT. If not, then skip it. Signed-off-by: George Liao <george.liao@intel.com>
2025-05-01ArmFfaLib: Replace SMCCC_VERSION check with FF-A version checkMohamed Gamal Morsy1-22/+19
Patch 8d03c42d38d1 ("ArmPkg: ArmFfaLib: Update FF-A direct message to support 18 registers") calls SMCCC_VERSION by default during FF-A initialization even if the SMC conduit is not enabled. This leads to sending malformed FF-A versions if the SVC conduit is used instead. This is observed for example when using an SPMC@EL-1 (e.g. rust-spmc) which receives the FF-A message via an SVC call and interprets SMCCC_VERSION as an FF-A Function ID and subsequently fails to handle it. Since 18-register support is only support with FF-A >= 1.2, replace SMCCC_VERSION check with FF-A version check Signed-off-by: Mohamed Gamal Morsy <mohamed.morsy@arm.com>
2025-04-30MdeModulePkg SpiBus: Use correct GUIDJack Hsieh2-3/+12
Fix incorrect guid in SpiBusDxe and add null checking for AllocateZeroPool in the SpiBus driver. Signed-off-by: Jack Hsieh <v-chhsieh@microsoft.com>
2025-04-27MdeModulePkg: DxeCore: Set Image Protections Through GCDOliver Smith-Denny2-7/+112
Today, SetUefiImageMemoryAttributes calls directly to the CPU Arch protocol to set EFI_MEMORY_XP or EFI_MEMORY_RO on image memory. However, this bypasses the GCD and so the GCD is out of sync with the actual state of memory. This can cause an issue in the scenario where a new attribute is being set (whether a virtual attribute or a real HW attribute), if the GCD attributes are queried for a region and the new attribute is appended to the existing GCD attributes (which are incorrect), then the incorrect attributes can get applied. This can result in setting EFI_MEMORY_XP on code sections of images and causing an execution fault. This patch updates SetUefiImageMemoryAttributes to call into the GCD to update the attributes there and let the GCD code call into the CPU Arch protocol to update the page table. Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2025-04-27MdeModulePkg: DxeCore: Lower Image Protection Print to Verbose Log LevelOliver Smith-Denny1-1/+1
The print that describes memory attributes being applied to image memory sections is currently at info level and very noisy, being printed multiple times per image. Reduce this to the verbose logging level. Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2025-04-25MdeModulePkg BmDriverHealth.c: Support dump the driver nameYang Gang1-15/+145
Sometimes the controller name is not present, add BmGetDriverName to retrieve the driver name.(Like DriverHealthManagerDxe) Signed-off-by: Yang Gang <yanggang@byosoft.com.cn>
2025-04-25DeviceManagerUiLib:Update DeviceManager form data when the form opens.Gao Qihang2-6/+22
Issue link:https://github.com/tianocore/edk2/issues/10925 If new HII resource is installed, show it in DeviceManager form. If HII resource is uninstalled, remove it from DeviceManager form. So once we enter DeviceManager form, form data should be refreshed to display dynamically. Cc: Li Chao <lichao@loongson.cn> Cc: Qian Dongyan <qiandongyan@loongson.cn> Signed-off-by: Gao Qihang <gaoqihang@loongson.cn>
2025-04-25DisplayEngineDxe: Fix length when displaying menu stringGao Qihang1-1/+2
Function `PrintStringAt` returns the count of Unicode character, which is not correct for computing column offset when display empty string if wide character is introduced. `GetStringWidth (String) / 2 - 1` is suitable option which is compatible with wide and narrow characters. Cc: Lichao <lichao@loongson.cn> Cc: Qian Dongyan <qiandongyan@loongson.cn> Signed-off-by: Gao Qihang <gaoqihang@loongson.cn>
2025-04-23MdeModulePkg/ArmFfaLib: Add depex on gEfiPeiMemoryDiscoveredPpiGuidAnubhav Raina1-1/+4
If ArmFfaLibRxTxMap is called before permanent memory is installed the memory allocated for the FF-A buffers will be migrated to the permanent memory after it is installed without updating gArmFfaRxTxBufferInfoGuid or unmapping the old buffers and mapping the updated buffers. An ASSERT in MemoryServices at ExitBootServices is triggered when ArmFfaDxeLib tries to call FreeAlignedPages on the original buffer reference. Add depex on gEfiPeiMemoryDiscoveredPpiGuid for ArmFfaPeiLib so any Peims that use FF-A are only dispatched after permanent memory is available. Signed-off-by: Anubhav Raina <anubhav.raina@arm.com>
2025-04-21MdeModulePkg: PiSmmIpl: Fix physical address dereferencingKun Qin1-36/+106
With current implemenation, all 3 SmmCommunication* functions go through the same routine, which will dereference the incoming pointer to inspect whether this is a V3 buffer or not. However, the caller always pass in the physical addresses, which could cause the system to page fault after OS take over the runtime control. This change reverted the common routine to its previous form to handle MM communicate v1 and v2. Additionally, a specific communicate function for v3 was created to support MM communicate v3. Co-authored-by: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2025-04-18MdeModulePkg: Add two new APIs in BaseHobLibNullDun Tan1-0/+55
This commit is to add two new APIs in MdeModulePkg BaseHobLibNull: 1.The GetNextMemoryAllocationGuidHob () returns the next instance of the Memory Allocation HOB with the matched GUID from a starting HOB pointer. 2.The TagMemoryAllocationHobWithGuid () searchs the HOB list for the Memory Allocation HOB with a matching base address and set the Name GUID. Then the instance of the tagged Memory Allocation HOB with matched base address is returned. Signed-off-by: Dun Tan <dun.tan@intel.com>
2025-04-17MdeModulePkg/PlatformDriOverrideDxe:Fix typosGao Qihang3-10/+10
`dynamicly`->`dynamically` Signed-off-by: Gao Qihang <gaoqihang@loongson.cn>
2025-04-17MdeModulePkg/DriverHealthManagerDxe:Fix typoGao Qihang1-1/+1
`dynamicly`->`dynamically` Signed-off-by: Gao Qihang <gaoqihang@loongson.cn>
2025-04-16MdeModulePkg/UsbMassStorageDxe: Remove excessive loggingPohan Wu1-1/+1
When a USB mass storage device is not ready (e.g., still powering up or the hard disk has not reached the desired RPM), the ExecCommand function fails.This failure is not a true error. Logging it as DEBUG_ERROR will generate logs for properly functioning devices as well, potentially flooding logs for older devices. As mentioned in the command, proper error information retrieval should occur in the sense request. The solution is to downgrade the log level from DEBUG_ERROR to DEBUG_INFO. Signed-off-by: Jack Pham <jackp@qti.qualcomm.com>
2025-04-16MdeModulePkg/UsbMassStorageDxe: Remove Port ResetPohan Wu1-12/+1
During USB mass storage enumeration, if a USB transfer fails due to any other reason, UsbMassStorageDxe will attempt to reset the device. With the commit ed07a2bb11 ("MdeModulePkg/UsbBusDxe: USB issue fix when the port reset"), UsbIoPortReset now tears down the USB device context and reinstalls it (via DisconnectController & ConnectController). This process is not handled by the UsbMassDriver, causing the upper layer to access an old pointer that has been freed during the teardown, leading to a crash. Example: UsbMassReadBlocks (Failed) -> UsbMassReset -> UsbBotResetDevice -> UsbIoPortReset (teardown + reinstall and return) Now the UsbBot context pointer is invalidated and pointing to freed memory. -> UsbBot->UsbIo->UsbControlTransfer() therefore accesses a invalid pointer and crashes. The fix is to ignore the ExtendedVerification, which is supposed to perform a more exhaustive verification operation during the reset. In MassStorageDxe, ExtendedVerification perform the parent port reset (UsbIoPortReset). Ultimately, the MassStorage device should not reset the parent port due to a transfer error. By not performing any extended verification, the teardown is prevented, thereby avoiding the crash. Signed-off-by: Jack Pham <jackp@qti.qualcomm.com>