NetworkPkg: Fix IpSec run into infinite loop issue in some case
authorJiaxin Wu <jiaxin.wu@intel.com>
Fri, 28 Aug 2015 07:00:32 +0000 (07:00 +0000)
committerjiaxinwu <jiaxinwu@Edk2>
Fri, 28 Aug 2015 07:00:32 +0000 (07:00 +0000)
v2:
* Update the copyright year and conditional judgment for removing.

When edit one SPEntry in 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.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18352 6f19259b-4bc3-4df7-8a09-765794883524

NetworkPkg/IpSecDxe/IpSecConfigImpl.c

index 6eabfe45dee804f98511a7bb4985c5d9025945dc..bd49245190bd330e8221eea8cec73daa1b5e0c12 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The implementation of IPSEC_CONFIG_PROTOCOL.\r
 \r
-  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -1199,6 +1199,9 @@ SetSpdEntry (
             (EFI_IPSEC_CONFIG_SELECTOR *) &SpdData->SaId[Index],\r
             (EFI_IPSEC_CONFIG_SELECTOR *) SadEntry->Id\r
             )) {\r
+        if (SadEntry->Data->SpdEntry != NULL) {  \r
+          RemoveEntryList (&SadEntry->BySpd);\r
+        }\r
         InsertTailList (&SpdEntry->Data->Sas, &SadEntry->BySpd);\r
         SadEntry->Data->SpdEntry = SpdEntry;\r
         DuplicateSpdSelector (\r