From 597cf8a19ff426bf5f8c03425c00acbc7ac8dd63 Mon Sep 17 00:00:00 2001 From: Zhang Lubo Date: Fri, 28 Apr 2017 14:41:33 +0800 Subject: [PATCH] NetworkPkg: Fix issue the iSCSI client can not send reset packet. if we already established a iSCSI connection from initiator to target based on IPv4 stack, after using reconnect -r command, we can not rebuild the session with the windows target, since the server thought the session is still exist. This issue is caused by wrong place of acquire ownership of sock lock which lead the iSCSI can not reset the connection correctly. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Zhang Lubo Cc: Wu Jiaxin Cc: Ye Ting Cc: Fu Siyuan Reviewed-by: Wu Jiaxin --- NetworkPkg/TcpDxe/SockInterface.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/NetworkPkg/TcpDxe/SockInterface.c b/NetworkPkg/TcpDxe/SockInterface.c index b4ba40afce..0248cdf6ff 100644 --- a/NetworkPkg/TcpDxe/SockInterface.c +++ b/NetworkPkg/TcpDxe/SockInterface.c @@ -169,18 +169,6 @@ SockDestroyChild ( ASSERT (Tcb != NULL); - Status = EfiAcquireLockOrFail (&(Sock->Lock)); - if (EFI_ERROR (Status)) { - - DEBUG ( - (EFI_D_ERROR, - "SockDestroyChild: Get the lock to access socket failed with %r\n", - Status) - ); - - return EFI_ACCESS_DENIED; - } - // // Close the IP protocol. // @@ -226,6 +214,19 @@ SockDestroyChild ( NULL ); + + Status = EfiAcquireLockOrFail (&(Sock->Lock)); + if (EFI_ERROR (Status)) { + + DEBUG ( + (EFI_D_ERROR, + "SockDestroyChild: Get the lock to access socket failed with %r\n", + Status) + ); + + return EFI_ACCESS_DENIED; + } + // // force protocol layer to detach the PCB // -- 2.39.2