public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [patch] MdeModulePkg: Fix issue the iSCSI client can not send reset packet correctly.
@ 2017-04-28  6:40 Zhang Lubo
  2017-04-28  8:25 ` Wu, Jiaxin
  2017-05-03  2:54 ` Ye, Ting
  0 siblings, 2 replies; 3+ messages in thread
From: Zhang Lubo @ 2017-04-28  6:40 UTC (permalink / raw)
  To: edk2-devel; +Cc: Wu Jiaxin, Ye Ting, Fu Siyuan

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 <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>
---
 MdeModulePkg/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 f8b535c..bca4b02 100644
--- a/MdeModulePkg/Universal/Network/Tcp4Dxe/SockInterface.c
+++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/SockInterface.c
@@ -160,19 +160,10 @@ SockDestroyChild (
   ProtoData = (TCP4_PROTO_DATA *) Sock->ProtoReserved;
   Tcb       = ProtoData->TcpPcb;
 
   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.
   //
   gBS->CloseProtocol (
          Tcb->IpInfo->ChildHandle,
@@ -212,10 +203,19 @@ SockDestroyChild (
         &gEfiTcp4ProtocolGuid,
         SockProtocol,
         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
   //
   Status = Sock->ProtoHandler (Sock, SOCK_DETACH, NULL);
 
-- 
1.9.5.msysgit.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-05-03  2:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-28  6:40 [patch] MdeModulePkg: Fix issue the iSCSI client can not send reset packet correctly Zhang Lubo
2017-04-28  8:25 ` Wu, Jiaxin
2017-05-03  2:54 ` Ye, Ting

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox