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 | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/NetworkPkg/IpSecDxe/IpSecConfigImpl.c 
b/NetworkPkg/IpSecDxe/IpSecConfigImpl.c
index 6eabfe4..c58b966 100644
--- a/NetworkPkg/IpSecDxe/IpSecConfigImpl.c
+++ b/NetworkPkg/IpSecDxe/IpSecConfigImpl.c
@@ -1197,10 +1197,13 @@ SetSpdEntry (
 
       if (CompareSaId (
             (EFI_IPSEC_CONFIG_SELECTOR *) &SpdData->SaId[Index],
             (EFI_IPSEC_CONFIG_SELECTOR *) SadEntry->Id
             )) {
+        if (!IsListEmpty (&SadEntry->BySpd)) {
+          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

Reply via email to