diff options
author | Jiaxin Wu <jiaxin.wu@intel.com> | 2016-06-30 15:53:01 +0800 |
---|---|---|
committer | Jiaxin Wu <jiaxin.wu@intel.com> | 2016-07-07 08:46:48 +0800 |
commit | eab4016490c863895c8773033dfe651b9dc90816 (patch) | |
tree | 415cd6ccf06dd72083120cfa98396d7a07cc71b4 /MdeModulePkg | |
parent | e06a4c0812cfac25a9eb1e8c851156fe19a29ab3 (diff) | |
download | edk2-platforms-eab4016490c863895c8773033dfe651b9dc90816.tar.xz |
MdeModulePkg: Fix IPv4 stack potential disappeared issue
IP4_CONFIG2_INSTANCE->DataItem is used to save the configuration
data to NV variable. When the policy is changed from static to
DHCP, DnsServers info will be cleaned from DataItem first
(See Ip4Config2SetPolicy), it's correct because DnsServers info
should not be saved to NV variable.
But if there is any DnsServers info received from DHCP message, it
will be reset to DataItem again (See Ip4Config2SetDnsServerWorker),
which may cause the NV variable contain the DnsServers info while
the policy is DHCP (See Ip4Config2WriteConfigData).
Then, while the platform is reset, the issue happened. Because
Ip4Config2DataTypeDnsServer is set under DHCP policy, which is not
allowed by UEFI Spec and error returned.
This patch is used to resolve this potential issue.
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Zhang Lubo <lubo.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Zhang Lubo <lubo.zhang@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r-- | MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c | 12 | ||||
-rw-r--r-- | MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.h | 1 | ||||
-rw-r--r-- | MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c | 4 |
3 files changed, 16 insertions, 1 deletions
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c index 028c61de06..f91a935634 100644 --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c @@ -1060,7 +1060,6 @@ Ip4Config2GetIfInfo ( IN VOID *Data OPTIONAL
)
{
-
IP4_SERVICE *IpSb;
UINTN Length;
IP4_CONFIG2_DATA_ITEM *Item;
@@ -1179,6 +1178,7 @@ Ip4Config2SetPolicy ( DataItem->Data.Ptr = NULL;
DataItem->DataSize = 0;
DataItem->Status = EFI_NOT_FOUND;
+ SET_DATA_ATTRIB (DataItem->Attribute, DATA_ATTRIB_VOLATILE);
NetMapIterate (&DataItem->EventMap, Ip4Config2SignalEvent, NULL);
} else {
//
@@ -1459,10 +1459,20 @@ Ip4Config2SetDnsServer ( IN VOID *Data
)
{
+ IP4_CONFIG2_DATA_ITEM *Item;
+
+ Item = NULL;
+
if (Instance->Policy != Ip4Config2PolicyStatic) {
return EFI_WRITE_PROTECTED;
}
+ Item = &Instance->DataItem[Ip4Config2DataTypeDnsServer];
+
+ if (DATA_ATTRIB_SET (Item->Attribute, DATA_ATTRIB_VOLATILE)) {
+ REMOVE_DATA_ATTRIB (Item->Attribute, DATA_ATTRIB_VOLATILE);
+ }
+
return Ip4Config2SetDnsServerWorker (Instance, DataSize, Data);
}
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.h b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.h index b2665bd3c1..b6da11f8ec 100644 --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.h +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.h @@ -27,6 +27,7 @@ #define DATA_ATTRIB_SET(Attrib, Bits) (BOOLEAN)((Attrib) & (Bits))
#define SET_DATA_ATTRIB(Attrib, Bits) ((Attrib) |= (Bits))
+#define REMOVE_DATA_ATTRIB(Attrib, Bits) ((Attrib) &= (~Bits))
typedef struct _IP4_CONFIG2_INSTANCE IP4_CONFIG2_INSTANCE;
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c index fcd3ccb9fd..20bc21fec1 100644 --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c @@ -598,6 +598,10 @@ Ip4DriverBindingStart ( if (EFI_ERROR(Status)) {
goto UNINSTALL_PROTOCOL;
}
+
+ if (Index == Ip4Config2DataTypePolicy && (*(DataItem->Data.Policy) == Ip4Config2PolicyDhcp)) {
+ break;
+ }
}
}
|