From e3793f9834fe9dcec6fda53fbe8df76d32c6f2fa Mon Sep 17 00:00:00 2001 From: "Zhang, Lubo" Date: Fri, 28 Apr 2017 14:40:49 +0800 Subject: [PATCH] MdeModulePkg: Fix issue the iSCSI client can not send reset packet correctly. 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 --- .../Universal/Network/Tcp4Dxe/SockInterface.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/SockInterface.c b/MdeModulePkg/Universal/Network/Tcp4Dxe/SockInterface.c index f8b535cf6e..bca4b02009 100644 --- a/MdeModulePkg/Universal/Network/Tcp4Dxe/SockInterface.c +++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/SockInterface.c @@ -162,15 +162,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. // @@ -214,6 +205,15 @@ 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