]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg: Fix potential failure if UseDefaultAddress configured
authorJiaxin Wu <jiaxin.wu@intel.com>
Mon, 15 Aug 2016 02:34:49 +0000 (10:34 +0800)
committerJiaxin Wu <jiaxin.wu@intel.com>
Thu, 18 Aug 2016 05:54:50 +0000 (13:54 +0800)
IpSb->Reconfig should not be set to TRUE to focal the reconfiguration
during the policy changes from Static to DHCP. It's redundancy because
the default router table and default addresses have been freed ahead (
Detailed see Ip4Config2OnPolicyChanged() function). Otherwise, the
potential failure will appear if UseDefaultAddress configured. Reproduce
steps see below:

#1. Set policy to DHCP.
#2. If DHCP process is not complete yet, then run one APP to invoke UDP4
Configure with "UseDefaultAddress = TRUE" (loop to call UDP4 Configure
until Ip4Mode.IsConfigured changes to TRUE).
#3. Even DHCP succeed but Ip4Mode.IsConfigured flag never set to TRUE

Concrete analysis is as follows:
In #1, the policy will be set to DHCP, and then Ip4Config2OnPolicyChanged()
will be called. In this function, if "IpSb->Reconfig" flag is set to TRUE,
the original "IpSb->DefaultInterface" will be abandoned/freed once the
DHCP process finished.

In #2, UDP4 Configure with "UseDefaultAddress = TRUE" is called, that means
the default interface (IpSb->DefaultInterface) will be selected as current
instance's interface.

In #3, when DHCP process finished, the original DefaultInterface will be
abandoned/freed because "IpSb->Reconfig" flag is true. Meanwhile, one new
interface is assigned to "IpSb->DefaultInterface". This new interface is
different to the original one assigned to the UDP4 Configured instance. So,
even DHCP process succeed, the up caller will never have the chance to get
it's truly status.

Cc: Cohen Eugene <eugene@hp.com>
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>
Tested-by: Eugene Cohen <eugene@hp.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c

index f91a935634415b13a60ddd13a3184e298b3a11eb..75ad3011d0bcc9546e4a47d568addb1168cc499c 100644 (file)
@@ -150,7 +150,6 @@ Ip4Config2OnPolicyChanged (
   // Start the dhcp configuration.\r
   //\r
   if (NewPolicy == Ip4Config2PolicyDhcp) {\r
-    IpSb->Reconfig = TRUE;\r
     Ip4StartAutoConfig (&IpSb->Ip4Config2Instance);\r
   }\r
 \r