]> git.proxmox.com Git - mirror_edk2.git/commitdiff
NetworkPkg: Fix issue the iSCSI client can not send reset packet.
authorZhang Lubo <lubo.zhang@intel.com>
Fri, 28 Apr 2017 06:41:33 +0000 (14:41 +0800)
committerJiaxin Wu <jiaxin.wu@intel.com>
Tue, 2 May 2017 03:11:39 +0000 (11:11 +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>
NetworkPkg/TcpDxe/SockInterface.c

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