mirror of https://github.com/acidanthera/audk.git
NetworkPkg: Add more parameter or return status check in UDP6 driver
In UDP6Dxe, there are several places that may be enhanced to check input parameters and returned status. This patch is to fix these issues. Cc: Ye Ting <ting.ye@intel.com> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wang Fan <fan.wang@intel.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
This commit is contained in:
parent
0f33366483
commit
ceec363801
|
@ -290,18 +290,15 @@ Udp6DriverBindingStop (
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
} else if (IsListEmpty (&Udp6Service->ChildrenList)) {
|
} else if (IsListEmpty (&Udp6Service->ChildrenList)) {
|
||||||
gBS->UninstallMultipleProtocolInterfaces (
|
Status = gBS->UninstallMultipleProtocolInterfaces (
|
||||||
NicHandle,
|
NicHandle,
|
||||||
&gEfiUdp6ServiceBindingProtocolGuid,
|
&gEfiUdp6ServiceBindingProtocolGuid,
|
||||||
&Udp6Service->ServiceBinding,
|
&Udp6Service->ServiceBinding,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
Udp6CleanService (Udp6Service);
|
Udp6CleanService (Udp6Service);
|
||||||
|
|
||||||
FreePool (Udp6Service);
|
FreePool (Udp6Service);
|
||||||
|
|
||||||
Status = EFI_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -510,21 +507,30 @@ Udp6ServiceBindingDestroyChild (
|
||||||
//
|
//
|
||||||
// Close the Ip6 protocol on the default IpIo.
|
// Close the Ip6 protocol on the default IpIo.
|
||||||
//
|
//
|
||||||
gBS->CloseProtocol (
|
Status = gBS->CloseProtocol (
|
||||||
Udp6Service->IpIo->ChildHandle,
|
Udp6Service->IpIo->ChildHandle,
|
||||||
&gEfiIp6ProtocolGuid,
|
&gEfiIp6ProtocolGuid,
|
||||||
gUdp6DriverBinding.DriverBindingHandle,
|
gUdp6DriverBinding.DriverBindingHandle,
|
||||||
Instance->ChildHandle
|
Instance->ChildHandle
|
||||||
);
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
Instance->InDestroy = FALSE;
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Close the Ip6 protocol on this instance's IpInfo.
|
// Close the Ip6 protocol on this instance's IpInfo.
|
||||||
//
|
//
|
||||||
gBS->CloseProtocol (
|
Status = gBS->CloseProtocol (
|
||||||
Instance->IpInfo->ChildHandle,
|
Instance->IpInfo->ChildHandle,
|
||||||
&gEfiIp6ProtocolGuid,
|
&gEfiIp6ProtocolGuid,
|
||||||
gUdp6DriverBinding.DriverBindingHandle,
|
gUdp6DriverBinding.DriverBindingHandle,
|
||||||
Instance->ChildHandle
|
Instance->ChildHandle
|
||||||
);
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
Instance->InDestroy = FALSE;
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Uninstall the Udp6Protocol previously installed on the ChildHandle.
|
// Uninstall the Udp6Protocol previously installed on the ChildHandle.
|
||||||
|
|
|
@ -57,6 +57,9 @@ Udp6FindInstanceByPort (
|
||||||
interface. It's called to signal the udp TxToken when the IpIo layer completes
|
interface. It's called to signal the udp TxToken when the IpIo layer completes
|
||||||
transmitting of the udp datagram.
|
transmitting of the udp datagram.
|
||||||
|
|
||||||
|
If Context is NULL, then ASSERT().
|
||||||
|
If NotifyData is NULL, then ASSERT().
|
||||||
|
|
||||||
@param[in] Status The completion status of the output udp datagram.
|
@param[in] Status The completion status of the output udp datagram.
|
||||||
@param[in] Context Pointer to the context data.
|
@param[in] Context Pointer to the context data.
|
||||||
@param[in] Sender Specify a EFI_IP6_PROTOCOL for sending.
|
@param[in] Sender Specify a EFI_IP6_PROTOCOL for sending.
|
||||||
|
@ -75,6 +78,10 @@ Udp6DgramSent (
|
||||||
/**
|
/**
|
||||||
This function processes the received datagram passed up by the IpIo layer.
|
This function processes the received datagram passed up by the IpIo layer.
|
||||||
|
|
||||||
|
If NetSession is NULL, then ASSERT().
|
||||||
|
If Packet is NULL, then ASSERT().
|
||||||
|
If Context is NULL, then ASSERT().
|
||||||
|
|
||||||
@param[in] Status The status of this udp datagram.
|
@param[in] Status The status of this udp datagram.
|
||||||
@param[in] IcmpError The IcmpError code, only available when Status is
|
@param[in] IcmpError The IcmpError code, only available when Status is
|
||||||
EFI_ICMP_ERROR.
|
EFI_ICMP_ERROR.
|
||||||
|
@ -977,6 +984,9 @@ Udp6RemoveToken (
|
||||||
interface. It's called to signal the udp TxToken when IpIo layer completes the
|
interface. It's called to signal the udp TxToken when IpIo layer completes the
|
||||||
transmitting of the udp datagram.
|
transmitting of the udp datagram.
|
||||||
|
|
||||||
|
If Context is NULL, then ASSERT().
|
||||||
|
If NotifyData is NULL, then ASSERT().
|
||||||
|
|
||||||
@param[in] Status The completion status of the output udp datagram.
|
@param[in] Status The completion status of the output udp datagram.
|
||||||
@param[in] Context Pointer to the context data.
|
@param[in] Context Pointer to the context data.
|
||||||
@param[in] Sender Specify a EFI_IP6_PROTOCOL for sending.
|
@param[in] Sender Specify a EFI_IP6_PROTOCOL for sending.
|
||||||
|
@ -995,6 +1005,8 @@ Udp6DgramSent (
|
||||||
UDP6_INSTANCE_DATA *Instance;
|
UDP6_INSTANCE_DATA *Instance;
|
||||||
EFI_UDP6_COMPLETION_TOKEN *Token;
|
EFI_UDP6_COMPLETION_TOKEN *Token;
|
||||||
|
|
||||||
|
ASSERT (Context != NULL && NotifyData != NULL);
|
||||||
|
|
||||||
Instance = (UDP6_INSTANCE_DATA *) Context;
|
Instance = (UDP6_INSTANCE_DATA *) Context;
|
||||||
Token = (EFI_UDP6_COMPLETION_TOKEN *) NotifyData;
|
Token = (EFI_UDP6_COMPLETION_TOKEN *) NotifyData;
|
||||||
|
|
||||||
|
@ -1012,6 +1024,10 @@ Udp6DgramSent (
|
||||||
/**
|
/**
|
||||||
This function processes the received datagram passed up by the IpIo layer.
|
This function processes the received datagram passed up by the IpIo layer.
|
||||||
|
|
||||||
|
If NetSession is NULL, then ASSERT().
|
||||||
|
If Packet is NULL, then ASSERT().
|
||||||
|
If Context is NULL, then ASSERT().
|
||||||
|
|
||||||
@param[in] Status The status of this udp datagram.
|
@param[in] Status The status of this udp datagram.
|
||||||
@param[in] IcmpError The IcmpError code, only available when Status is
|
@param[in] IcmpError The IcmpError code, only available when Status is
|
||||||
EFI_ICMP_ERROR.
|
EFI_ICMP_ERROR.
|
||||||
|
@ -1031,6 +1047,7 @@ Udp6DgramRcvd (
|
||||||
IN VOID *Context
|
IN VOID *Context
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
ASSERT (NetSession != NULL && Packet != NULL && Context != NULL);
|
||||||
NET_CHECK_SIGNATURE (Packet, NET_BUF_SIGNATURE);
|
NET_CHECK_SIGNATURE (Packet, NET_BUF_SIGNATURE);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -381,7 +381,7 @@ Udp6Groups (
|
||||||
Status = NetMapInsertTail (&Instance->McastIps, (VOID *) McastIp, NULL);
|
Status = NetMapInsertTail (&Instance->McastIps, (VOID *) McastIp, NULL);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
NetMapIterate (&Instance->McastIps, Udp6LeaveGroup, MulticastAddress);
|
Status = NetMapIterate (&Instance->McastIps, Udp6LeaveGroup, MulticastAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
ON_EXIT:
|
ON_EXIT:
|
||||||
|
|
Loading…
Reference in New Issue