MdeModulePkg: Fix service binding issue in TCP4 and Ip4 dxe.

v2: Handle error case in SockCreateChild and fix typo issue

when we destroy the socket Sock and its associated
protocol control block, we need to first close the
parent protocol, then remove the protocol from childHandle
and last to free any data structures that allocated in
CreateChild. But currently, we free the socket data
(Socket ConfigureState) before removing the protocol
form  the childhandle. So if the up layer want to send the
tcp reset packet in it's driver binding stop function, it will failed.

The IpInstance destroy state is redundant and may cause
ip transmit failed if up layer want to send ip packet.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
This commit is contained in:
Zhang Lubo
2017-03-16 18:03:36 +08:00
committed by Jiaxin Wu
parent 962e62bcd8
commit 4bb89650f5
7 changed files with 96 additions and 77 deletions

View File

@@ -550,6 +550,7 @@ Ip4InitProtocol (
IpInstance->Signature = IP4_PROTOCOL_SIGNATURE;
CopyMem (&IpInstance->Ip4Proto, &mEfiIp4ProtocolTemplete, sizeof (IpInstance->Ip4Proto));
IpInstance->State = IP4_STATE_UNCONFIGED;
IpInstance->InDestroy = FALSE;
IpInstance->Service = IpSb;
InitializeListHead (&IpInstance->Link);
@@ -936,8 +937,7 @@ EfiIp4Configure (
Status = Ip4CleanProtocol (IpInstance);
//
// Don't change the state if it is DESTROY, consider the following
// valid sequence: Mnp is unloaded-->Ip Stopped-->Udp Stopped,
// Consider the following valid sequence: Mnp is unloaded-->Ip Stopped-->Udp Stopped,
// Configure (ThisIp, NULL). If the state is changed to UNCONFIGED,
// the unload fails miserably.
//