[edk2] [PATCH v2] NetworkPkg: Fix IpSec run into infinite loop issue

2015-08-28 Thread Jiaxin Wu
v2:
* Update the copyright year and conditional judgment for removing.

When use -e to edit SPD database, the corresponding SA entry will
be updated to the sas list of the new SPD entry. But before that, all
of them should be removed from the original sas list. If not, the list
will be broken into infinite loop.

Cc: Ye Ting ting...@intel.com
Cc: Fu Siyuan siyuan...@intel.com
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu jiaxin...@intel.com
---
 NetworkPkg/IpSecDxe/IpSecConfigImpl.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/NetworkPkg/IpSecDxe/IpSecConfigImpl.c 
b/NetworkPkg/IpSecDxe/IpSecConfigImpl.c
index 6eabfe4..bd49245 100644
--- a/NetworkPkg/IpSecDxe/IpSecConfigImpl.c
+++ b/NetworkPkg/IpSecDxe/IpSecConfigImpl.c
@@ -1,9 +1,9 @@
 /** @file
   The implementation of IPSEC_CONFIG_PROTOCOL.
 
-  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.BR
+  Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.BR
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
   http://opensource.org/licenses/bsd-license.php.
@@ -1197,10 +1197,13 @@ SetSpdEntry (
 
   if (CompareSaId (
 (EFI_IPSEC_CONFIG_SELECTOR *) SpdData-SaId[Index],
 (EFI_IPSEC_CONFIG_SELECTOR *) SadEntry-Id
 )) {
+if (SadEntry-Data-SpdEntry != NULL) {  
+  RemoveEntryList (SadEntry-BySpd);
+}
 InsertTailList (SpdEntry-Data-Sas, SadEntry-BySpd);
 SadEntry-Data-SpdEntry = SpdEntry;
 DuplicateSpdSelector (
   (EFI_IPSEC_CONFIG_SELECTOR *)SadEntry-Data-SpdSelector,
   (EFI_IPSEC_CONFIG_SELECTOR *)SpdEntry-Selector,
-- 
1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v2] NetworkPkg: Fix IpSec run into infinite loop issue

2015-08-28 Thread Ye, Ting
Reviewed-by: Ye Ting ting...@intel.com 

-Original Message-
From: Wu, Jiaxin 
Sent: Friday, August 28, 2015 2:42 PM
To: Fu, Siyuan; edk2-devel@lists.01.org
Cc: Ye, Ting
Subject: RE: [PATCH v2] NetworkPkg: Fix IpSec run into infinite loop issue

Thanks Siyuan, I will revise the description before check in.

-Original Message-
From: Fu, Siyuan 
Sent: Friday, August 28, 2015 2:37 PM
To: Wu, Jiaxin; edk2-devel@lists.01.org
Cc: Ye, Ting
Subject: RE: [PATCH v2] NetworkPkg: Fix IpSec run into infinite loop issue

Jiaxin

The patch is good to me, but I suggest you do not use -e in the patch 
comments since it's just a flag of the IpsecConfig tool, not for the IpSec 
driver. You'd better describe what happened in IpSec when user use -e more 
clearly.


Reviewed-by: Fu Siyuan siyuan...@intel.com



-Original Message-
From: Wu, Jiaxin
Sent: Friday, August 28, 2015 2:07 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting ting...@intel.com; Fu, Siyuan siyuan...@intel.com
Subject: [PATCH v2] NetworkPkg: Fix IpSec run into infinite loop issue

v2:
* Update the copyright year and conditional judgment for removing.

When use -e to edit SPD database, the corresponding SA entry will be updated 
to the sas list of the new SPD entry. But before that, all of them should be 
removed from the original sas list. If not, the list will be broken into 
infinite loop.

Cc: Ye Ting ting...@intel.com
Cc: Fu Siyuan siyuan...@intel.com
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu jiaxin...@intel.com
---
 NetworkPkg/IpSecDxe/IpSecConfigImpl.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/NetworkPkg/IpSecDxe/IpSecConfigImpl.c 
b/NetworkPkg/IpSecDxe/IpSecConfigImpl.c
index 6eabfe4..bd49245 100644
--- a/NetworkPkg/IpSecDxe/IpSecConfigImpl.c
+++ b/NetworkPkg/IpSecDxe/IpSecConfigImpl.c
@@ -1,9 +1,9 @@
 /** @file
   The implementation of IPSEC_CONFIG_PROTOCOL.
 
-  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.BR
+  Copyright (c) 2009 - 2015, Intel Corporation. All rights 
+ reserved.BR
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
   http://opensource.org/licenses/bsd-license.php.
@@ -1197,10 +1197,13 @@ SetSpdEntry (
 
   if (CompareSaId (
 (EFI_IPSEC_CONFIG_SELECTOR *) SpdData-SaId[Index],
 (EFI_IPSEC_CONFIG_SELECTOR *) SadEntry-Id
 )) {
+if (SadEntry-Data-SpdEntry != NULL) {  
+  RemoveEntryList (SadEntry-BySpd);
+}
 InsertTailList (SpdEntry-Data-Sas, SadEntry-BySpd);
 SadEntry-Data-SpdEntry = SpdEntry;
 DuplicateSpdSelector (
   (EFI_IPSEC_CONFIG_SELECTOR *)SadEntry-Data-SpdSelector,
   (EFI_IPSEC_CONFIG_SELECTOR *)SpdEntry-Selector,
--
1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel