Re: [edk2-devel] [PATCH 14/35] MdeModulePkg: fix UninstallMultipleProtocolInterfaces() calls
Reviewed-by: Ray Ni > -Original Message- > From: Laszlo Ersek > Sent: Tuesday, September 17, 2019 12:49 PM > To: edk2-devel-groups-io > Cc: Wu, Hao A ; Wang, Jian J ; Ni, > Ray > Subject: [PATCH 14/35] MdeModulePkg: fix > UninstallMultipleProtocolInterfaces() calls > > Unlike the InstallMultipleProtocolInterfaces() boot service, which takes > an (EFI_HANDLE*) as first parameter, the > UninstallMultipleProtocolInterfaces() boot service takes an EFI_HANDLE as > first parameter. > > These are actual bugs. They must have remained hidden until now because > they are on error paths. Fix the UninstallMultipleProtocolInterfaces() > calls. > > Cc: Hao A Wu > Cc: Jian J Wang > Cc: Ray Ni > Signed-off-by: Laszlo Ersek > --- > > Notes: > build-tested only > > MdeModulePkg/Bus/I2c/I2cDxe/I2cBus.c | 2 +- > MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c | 2 +- > MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c| 6 +++--- > MdeModulePkg/Bus/Pci/PciSioSerialDxe/Serial.c| 2 +- > MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.c| 2 +- > MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c | 2 +- > MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassImpl.c | 2 +- > 7 files changed, 9 insertions(+), 9 deletions(-) > > diff --git a/MdeModulePkg/Bus/I2c/I2cDxe/I2cBus.c > b/MdeModulePkg/Bus/I2c/I2cDxe/I2cBus.c > index 2b54ec51dca0..ed33a51da252 100644 > --- a/MdeModulePkg/Bus/I2c/I2cDxe/I2cBus.c > +++ b/MdeModulePkg/Bus/I2c/I2cDxe/I2cBus.c > @@ -720,7 +720,7 @@ Error: > > if (I2cBusContext != NULL) { >Status = gBS->UninstallMultipleProtocolInterfaces ( > - , > + Controller, >gEfiCallerIdGuid, >I2cBusContext, >NULL > diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c > b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c > index c6e401176a4b..3bde96bc9576 100644 > --- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c > +++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c > @@ -244,7 +244,7 @@ EnumerateNvmeDevNamespace ( >); >if(EFI_ERROR(Status)) { > gBS->UninstallMultipleProtocolInterfaces ( > - >DeviceHandle, > + Device->DeviceHandle, > , > Device->DevicePath, > , > diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c > b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c > index b7832c6970ad..292dd25da817 100644 > --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c > +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c > @@ -313,7 +313,7 @@ RegisterPciDevice ( > ); > if (EFI_ERROR (Status)) { >gBS->UninstallMultipleProtocolInterfaces ( > - >Handle, > + PciIoDevice->Handle, > , > PciIoDevice->DevicePath, > , > @@ -351,7 +351,7 @@ RegisterPciDevice ( > ); > if (EFI_ERROR (Status)) { >gBS->UninstallMultipleProtocolInterfaces ( > - >Handle, > + PciIoDevice->Handle, > , > PciIoDevice->DevicePath, > , > @@ -360,7 +360,7 @@ RegisterPciDevice ( > ); >if (HasEfiImage) { > gBS->UninstallMultipleProtocolInterfaces ( > - >Handle, > + PciIoDevice->Handle, > , > >LoadFile2, > NULL > diff --git a/MdeModulePkg/Bus/Pci/PciSioSerialDxe/Serial.c > b/MdeModulePkg/Bus/Pci/PciSioSerialDxe/Serial.c > index 82db93a8b117..9fe8a482e067 100644 > --- a/MdeModulePkg/Bus/Pci/PciSioSerialDxe/Serial.c > +++ b/MdeModulePkg/Bus/Pci/PciSioSerialDxe/Serial.c > @@ -665,7 +665,7 @@ CreateSerialDevice ( > >if (EFI_ERROR (Status)) { > gBS->UninstallMultipleProtocolInterfaces ( > - >Handle, > + SerialDevice->Handle, > , SerialDevice->DevicePath, > , >SerialIo, > NULL > diff --git a/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.c > b/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.c > index 62f18d1878bd..e2ae56c5058a 100644 > --- a/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.c > +++ b/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.c > @@ -475,7 +475,7 @@ InstallProtocolOnPartition ( > ); > if (EFI_ERROR (Status)) { >gBS->UninstallMultipleProtocolInterfaces ( > - >Handle, > + Partition->Handle, > , > Partition->DevicePath, > , > diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c > b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c > index eaa0d70024bb..cc0de52de411 100644 > --- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c > +++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c > @@ -159,7 +159,7 @@ UsbCreateInterface ( > >if (EFI_ERROR (Status)) { >
[edk2-devel] [PATCH 14/35] MdeModulePkg: fix UninstallMultipleProtocolInterfaces() calls
Unlike the InstallMultipleProtocolInterfaces() boot service, which takes an (EFI_HANDLE*) as first parameter, the UninstallMultipleProtocolInterfaces() boot service takes an EFI_HANDLE as first parameter. These are actual bugs. They must have remained hidden until now because they are on error paths. Fix the UninstallMultipleProtocolInterfaces() calls. Cc: Hao A Wu Cc: Jian J Wang Cc: Ray Ni Signed-off-by: Laszlo Ersek --- Notes: build-tested only MdeModulePkg/Bus/I2c/I2cDxe/I2cBus.c | 2 +- MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c | 2 +- MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c| 6 +++--- MdeModulePkg/Bus/Pci/PciSioSerialDxe/Serial.c| 2 +- MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.c| 2 +- MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c | 2 +- MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassImpl.c | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/MdeModulePkg/Bus/I2c/I2cDxe/I2cBus.c b/MdeModulePkg/Bus/I2c/I2cDxe/I2cBus.c index 2b54ec51dca0..ed33a51da252 100644 --- a/MdeModulePkg/Bus/I2c/I2cDxe/I2cBus.c +++ b/MdeModulePkg/Bus/I2c/I2cDxe/I2cBus.c @@ -720,7 +720,7 @@ Error: if (I2cBusContext != NULL) { Status = gBS->UninstallMultipleProtocolInterfaces ( - , + Controller, gEfiCallerIdGuid, I2cBusContext, NULL diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c index c6e401176a4b..3bde96bc9576 100644 --- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c +++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c @@ -244,7 +244,7 @@ EnumerateNvmeDevNamespace ( ); if(EFI_ERROR(Status)) { gBS->UninstallMultipleProtocolInterfaces ( - >DeviceHandle, + Device->DeviceHandle, , Device->DevicePath, , diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c index b7832c6970ad..292dd25da817 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c @@ -313,7 +313,7 @@ RegisterPciDevice ( ); if (EFI_ERROR (Status)) { gBS->UninstallMultipleProtocolInterfaces ( - >Handle, + PciIoDevice->Handle, , PciIoDevice->DevicePath, , @@ -351,7 +351,7 @@ RegisterPciDevice ( ); if (EFI_ERROR (Status)) { gBS->UninstallMultipleProtocolInterfaces ( - >Handle, + PciIoDevice->Handle, , PciIoDevice->DevicePath, , @@ -360,7 +360,7 @@ RegisterPciDevice ( ); if (HasEfiImage) { gBS->UninstallMultipleProtocolInterfaces ( - >Handle, + PciIoDevice->Handle, , >LoadFile2, NULL diff --git a/MdeModulePkg/Bus/Pci/PciSioSerialDxe/Serial.c b/MdeModulePkg/Bus/Pci/PciSioSerialDxe/Serial.c index 82db93a8b117..9fe8a482e067 100644 --- a/MdeModulePkg/Bus/Pci/PciSioSerialDxe/Serial.c +++ b/MdeModulePkg/Bus/Pci/PciSioSerialDxe/Serial.c @@ -665,7 +665,7 @@ CreateSerialDevice ( if (EFI_ERROR (Status)) { gBS->UninstallMultipleProtocolInterfaces ( - >Handle, + SerialDevice->Handle, , SerialDevice->DevicePath, , >SerialIo, NULL diff --git a/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.c b/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.c index 62f18d1878bd..e2ae56c5058a 100644 --- a/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.c +++ b/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.c @@ -475,7 +475,7 @@ InstallProtocolOnPartition ( ); if (EFI_ERROR (Status)) { gBS->UninstallMultipleProtocolInterfaces ( - >Handle, + Partition->Handle, , Partition->DevicePath, , diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c index eaa0d70024bb..cc0de52de411 100644 --- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c +++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c @@ -159,7 +159,7 @@ UsbCreateInterface ( if (EFI_ERROR (Status)) { gBS->UninstallMultipleProtocolInterfaces ( - >Handle, + UsbIf->Handle, , UsbIf->DevicePath, , diff --git a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassImpl.c b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassImpl.c index 8c27e18cdb87..0dcbc5da2cb8 100644 --- a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassImpl.c +++ b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassImpl.c @@ -575,7 +575,7 @@ UsbMassInitMultiLun ( if (EFI_ERROR (Status)) { DEBUG ((EFI_D_ERROR, "UsbMassInitMultiLun: