Skip to content

Commit e36d5ac

Browse files
hwu25mergify[bot]
authored andcommitted
MdeModulePkg/SdMmcPciHcDxe: Fix double PciIo Unmap in TRB creation (CVE-2019-14587)
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1989 The commit will avoid unmapping the same resource in error handling logic for function BuildAdmaDescTable() and SdMmcCreateTrb(). For the error handling in BuildAdmaDescTable(): The error is directly related with the corresponding Map() operation (mapped address beyond 4G, which is not supported in ADMA), so the Unmap() operation is done in the error handling logic, and then setting 'Trb->AdmaMap' to NULL to avoid double Unmap. For the error handling in SdMmcCreateTrb(): The error is not directly related with the corresponding Map() operation, so the commit will update the code to left SdMmcFreeTrb() for the Unmap operation to avoid double Unmap. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Hao A Wu <hao.a.wu@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
1 parent f1d78c4 commit e36d5ac

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1544,6 +1544,8 @@ BuildAdmaDescTable (
15441544
PciIo,
15451545
Trb->AdmaMap
15461546
);
1547+
Trb->AdmaMap = NULL;
1548+
15471549
PciIo->FreeBuffer (
15481550
PciIo,
15491551
EFI_SIZE_TO_PAGES (TableSize),
@@ -1753,7 +1755,6 @@ SdMmcCreateTrb (
17531755
}
17541756
Status = BuildAdmaDescTable (Trb, Private->ControllerVersion[Slot]);
17551757
if (EFI_ERROR (Status)) {
1756-
PciIo->Unmap (PciIo, Trb->DataMap);
17571758
goto Error;
17581759
}
17591760
} else if (Private->Capability[Slot].Sdma != 0) {

0 commit comments

Comments
 (0)