]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg: Fix issue the iSCSI client can not send reset packet correctly.
authorZhang, Lubo <lubo.zhang@intel.com>
Fri, 28 Apr 2017 06:40:49 +0000 (14:40 +0800)
committerJiaxin Wu <jiaxin.wu@intel.com>
Tue, 2 May 2017 03:09:32 +0000 (11:09 +0800)
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>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
MdeModulePkg/Universal/Network/Tcp4Dxe/SockInterface.c

index f8b535cf6e7f0ad125a1647bf22e063daca7ff1e..bca4b02009df8da0ba7a2d995e3e63881abd7db9 100644 (file)
@@ -162,15 +162,6 @@ SockDestroyChild (
 \r
   ASSERT (Tcb != NULL);\r
 \r
-  Status = EfiAcquireLockOrFail (&(Sock->Lock));\r
-  if (EFI_ERROR (Status)) {\r
-\r
-    DEBUG ((EFI_D_ERROR, "SockDestroyChild: Get the lock to "\r
-      "access socket failed with %r\n", Status));\r
-\r
-    return EFI_ACCESS_DENIED;\r
-  }\r
-\r
   //\r
   // Close the IP protocol.\r
   //\r
@@ -214,6 +205,15 @@ SockDestroyChild (
         NULL\r
         );\r
 \r
+  Status = EfiAcquireLockOrFail (&(Sock->Lock));\r
+  if (EFI_ERROR (Status)) {\r
+\r
+    DEBUG ((EFI_D_ERROR, "SockDestroyChild: Get the lock to "\r
+      "access socket failed with %r\n", Status));\r
+\r
+    return EFI_ACCESS_DENIED;\r
+  }\r
+\r
   //\r
   // force protocol layer to detach the PCB\r
   //\r