mirror of https://github.com/acidanthera/audk.git
1. remove duplicated NetLibDispatchDpc() calling in Pool function.
2. use mde library 3. add security check. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8860 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
d2eec31912
commit
a4df47f109
|
@ -253,7 +253,7 @@ Dhcp4CreateService (
|
|||
|
||||
ON_ERROR:
|
||||
Dhcp4CloseService (DhcpSb);
|
||||
gBS->FreePool (DhcpSb);
|
||||
FreePool (DhcpSb);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
@ -334,7 +334,7 @@ Dhcp4DriverBindingStart (
|
|||
|
||||
ON_ERROR:
|
||||
Dhcp4CloseService (DhcpSb);
|
||||
gBS->FreePool (DhcpSb);
|
||||
FreePool (DhcpSb);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -417,7 +417,7 @@ Dhcp4DriverBindingStop (
|
|||
|
||||
Dhcp4CloseService (DhcpSb);
|
||||
|
||||
gBS->FreePool (DhcpSb);
|
||||
FreePool (DhcpSb);
|
||||
} else {
|
||||
//
|
||||
// Don't use NET_LIST_FOR_EACH_SAFE here, Dhcp4ServiceBindingDestoryChild
|
||||
|
@ -522,7 +522,7 @@ Dhcp4ServiceBindingCreateChild (
|
|||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
gBS->FreePool (Instance);
|
||||
FreePool (Instance);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -547,7 +547,7 @@ Dhcp4ServiceBindingCreateChild (
|
|||
NULL
|
||||
);
|
||||
|
||||
gBS->FreePool (Instance);
|
||||
FreePool (Instance);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -668,6 +668,6 @@ Dhcp4ServiceBindingDestroyChild (
|
|||
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
|
||||
gBS->FreePool (Instance);
|
||||
FreePool (Instance);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -427,21 +427,21 @@ DhcpCleanConfigure (
|
|||
UINT32 Index;
|
||||
|
||||
if (Config->DiscoverTimeout != NULL) {
|
||||
gBS->FreePool (Config->DiscoverTimeout);
|
||||
FreePool (Config->DiscoverTimeout);
|
||||
}
|
||||
|
||||
if (Config->RequestTimeout != NULL) {
|
||||
gBS->FreePool (Config->RequestTimeout);
|
||||
FreePool (Config->RequestTimeout);
|
||||
}
|
||||
|
||||
if (Config->OptionList != NULL) {
|
||||
for (Index = 0; Index < Config->OptionCount; Index++) {
|
||||
if (Config->OptionList[Index] != NULL) {
|
||||
gBS->FreePool (Config->OptionList[Index]);
|
||||
FreePool (Config->OptionList[Index]);
|
||||
}
|
||||
}
|
||||
|
||||
gBS->FreePool (Config->OptionList);
|
||||
FreePool (Config->OptionList);
|
||||
}
|
||||
|
||||
ZeroMem (Config, sizeof (EFI_DHCP4_CONFIG_DATA));
|
||||
|
@ -564,14 +564,14 @@ DhcpYieldControl (
|
|||
DhcpSb->ActiveChild = NULL;
|
||||
|
||||
if (Config->DiscoverTimeout != NULL) {
|
||||
gBS->FreePool (Config->DiscoverTimeout);
|
||||
FreePool (Config->DiscoverTimeout);
|
||||
|
||||
Config->DiscoverTryCount = 0;
|
||||
Config->DiscoverTimeout = NULL;
|
||||
}
|
||||
|
||||
if (Config->RequestTimeout != NULL) {
|
||||
gBS->FreePool (Config->RequestTimeout);
|
||||
FreePool (Config->RequestTimeout);
|
||||
|
||||
Config->RequestTryCount = 0;
|
||||
Config->RequestTimeout = NULL;
|
||||
|
|
|
@ -446,17 +446,17 @@ DhcpCleanLease (
|
|||
DhcpSb->ServerAddr = 0;
|
||||
|
||||
if (DhcpSb->LastOffer != NULL) {
|
||||
gBS->FreePool (DhcpSb->LastOffer);
|
||||
FreePool (DhcpSb->LastOffer);
|
||||
DhcpSb->LastOffer = NULL;
|
||||
}
|
||||
|
||||
if (DhcpSb->Selected != NULL) {
|
||||
gBS->FreePool (DhcpSb->Selected);
|
||||
FreePool (DhcpSb->Selected);
|
||||
DhcpSb->Selected = NULL;
|
||||
}
|
||||
|
||||
if (DhcpSb->Para != NULL) {
|
||||
gBS->FreePool (DhcpSb->Para);
|
||||
FreePool (DhcpSb->Para);
|
||||
DhcpSb->Para = NULL;
|
||||
}
|
||||
|
||||
|
@ -636,7 +636,7 @@ DhcpHandleSelect (
|
|||
|
||||
if (Status == EFI_SUCCESS) {
|
||||
if (DhcpSb->LastOffer != NULL) {
|
||||
gBS->FreePool (DhcpSb->LastOffer);
|
||||
FreePool (DhcpSb->LastOffer);
|
||||
}
|
||||
|
||||
DhcpSb->LastOffer = Packet;
|
||||
|
@ -645,7 +645,7 @@ DhcpHandleSelect (
|
|||
|
||||
} else if (Status == EFI_NOT_READY) {
|
||||
if (DhcpSb->LastOffer != NULL) {
|
||||
gBS->FreePool (DhcpSb->LastOffer);
|
||||
FreePool (DhcpSb->LastOffer);
|
||||
}
|
||||
|
||||
DhcpSb->LastOffer = Packet;
|
||||
|
@ -907,18 +907,14 @@ DhcpHandleReboot (
|
|||
//
|
||||
// OK, get the parameter from server, record the lease
|
||||
//
|
||||
DhcpSb->Para = AllocatePool (sizeof (DHCP_PARAMETER));
|
||||
|
||||
DhcpSb->Para = AllocateCopyPool (sizeof (DHCP_PARAMETER), Para);
|
||||
if (DhcpSb->Para == NULL) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto ON_EXIT;
|
||||
}
|
||||
|
||||
DhcpSb->Selected = Packet;
|
||||
CopyMem (DhcpSb->Para, Para, sizeof (*DhcpSb->Para));
|
||||
|
||||
Status = DhcpLeaseAcquired (DhcpSb);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
@ -1063,7 +1059,7 @@ DhcpInput (
|
|||
}
|
||||
|
||||
if (Para != NULL) {
|
||||
gBS->FreePool (Para);
|
||||
FreePool (Para);
|
||||
}
|
||||
|
||||
Packet = NULL;
|
||||
|
|
|
@ -604,7 +604,6 @@ DhcpParseOption (
|
|||
*OptionPoint = NULL;
|
||||
|
||||
if (OptNum == 0) {
|
||||
Status = EFI_NOT_FOUND;
|
||||
goto ON_EXIT;
|
||||
}
|
||||
|
||||
|
@ -626,14 +625,14 @@ DhcpParseOption (
|
|||
Status = DhcpIterateOptions (Packet, DhcpFillOption, &Context);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
gBS->FreePool (Options);
|
||||
FreePool (Options);
|
||||
goto ON_EXIT;
|
||||
}
|
||||
|
||||
*OptionPoint = Options;
|
||||
|
||||
ON_EXIT:
|
||||
gBS->FreePool (OptCount);
|
||||
FreePool (OptCount);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -675,7 +674,8 @@ DhcpValidateOptions (
|
|||
if (EFI_ERROR (Status) || (Count == 0)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
ASSERT (AllOption != NULL);
|
||||
|
||||
Updated = FALSE;
|
||||
ZeroMem (&Parameter, sizeof (Parameter));
|
||||
|
||||
|
@ -710,16 +710,15 @@ DhcpValidateOptions (
|
|||
}
|
||||
|
||||
if (Updated && (Para != NULL)) {
|
||||
if ((*Para = AllocatePool (sizeof (DHCP_PARAMETER))) == NULL) {
|
||||
*Para = AllocateCopyPool (sizeof (DHCP_PARAMETER), &Parameter);
|
||||
if (*Para == NULL) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto ON_EXIT;
|
||||
}
|
||||
|
||||
CopyMem (*Para, &Parameter, sizeof (**Para));
|
||||
}
|
||||
|
||||
ON_EXIT:
|
||||
gBS->FreePool (AllOption);
|
||||
FreePool (AllOption);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -825,10 +824,11 @@ DhcpBuild (
|
|||
if (EFI_ERROR (Status)) {
|
||||
goto ON_ERROR;
|
||||
}
|
||||
ASSERT (SeedOptions != NULL);
|
||||
|
||||
for (Index = 0; Index < (UINT32) Count; Index++) {
|
||||
Mark[SeedOptions[Index].Tag] = SeedOptions[Index];
|
||||
if (SeedOptions != NULL) {
|
||||
for (Index = 0; Index < (UINT32) Count; Index++) {
|
||||
Mark[SeedOptions[Index].Tag] = SeedOptions[Index];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -888,9 +888,9 @@ DhcpBuild (
|
|||
|
||||
ON_ERROR:
|
||||
if (SeedOptions != NULL) {
|
||||
gBS->FreePool (SeedOptions);
|
||||
FreePool (SeedOptions);
|
||||
}
|
||||
|
||||
gBS->FreePool (Mark);
|
||||
FreePool (Mark);
|
||||
return Status;
|
||||
}
|
||||
|
|
|
@ -962,11 +962,6 @@ MnpReceivePacket (
|
|||
//
|
||||
MnpDeliverPacket (MnpServiceData);
|
||||
|
||||
//
|
||||
// Dispatch the DPC queued by the NotifyFunction of rx token's events.
|
||||
//
|
||||
NetLibDispatchDpc ();
|
||||
|
||||
EXIT:
|
||||
|
||||
ASSERT (Nbuf->TotalSize == MnpServiceData->BufferLength);
|
||||
|
@ -1066,5 +1061,8 @@ MnpSystemPoll (
|
|||
//
|
||||
MnpReceivePacket (MnpServiceData);
|
||||
|
||||
//
|
||||
// Dispatch the DPC queued by the NotifyFunction of rx token's events.
|
||||
//
|
||||
NetLibDispatchDpc ();
|
||||
}
|
||||
|
|
|
@ -771,6 +771,9 @@ MnpPoll (
|
|||
//
|
||||
Status = MnpReceivePacket (Instance->MnpServiceData);
|
||||
|
||||
//
|
||||
// Dispatch the DPC queued by the NotifyFunction of rx token's events.
|
||||
//
|
||||
NetLibDispatchDpc ();
|
||||
|
||||
ON_EXIT:
|
||||
|
|
Loading…
Reference in New Issue