From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id F2F4F2195406F for ; Thu, 27 Apr 2017 23:41:35 -0700 (PDT) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Apr 2017 23:41:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,387,1488873600"; d="scan'208";a="81666484" Received: from shwdeopenpsi116.ccr.corp.intel.com ([10.239.9.5]) by orsmga004.jf.intel.com with ESMTP; 27 Apr 2017 23:41:34 -0700 From: Zhang Lubo To: edk2-devel@lists.01.org Cc: Wu Jiaxin , Ye Ting , Fu Siyuan Date: Fri, 28 Apr 2017 14:41:33 +0800 Message-Id: <1493361693-5112-1-git-send-email-lubo.zhang@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 Subject: [patch] NetworkPkg: Fix issue the iSCSI client can not send reset packet. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Apr 2017 06:41:36 -0000 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 --- 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 b4ba40a..0248cdf 100644 --- a/NetworkPkg/TcpDxe/SockInterface.c +++ b/NetworkPkg/TcpDxe/SockInterface.c @@ -167,22 +167,10 @@ SockDestroyChild ( ProtoData = (TCP_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, @@ -224,10 +212,23 @@ SockDestroyChild ( TcpProtocolGuid, 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