From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by ml01.01.org (Postfix) with ESMTP id 8FD231A1E10 for ; Sun, 14 Aug 2016 19:47:00 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP; 14 Aug 2016 19:47:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,523,1464678000"; d="scan'208";a="1014337659" Received: from jiaxinwu-mobl2.ccr.corp.intel.com ([10.239.196.132]) by orsmga001.jf.intel.com with ESMTP; 14 Aug 2016 19:46:59 -0700 From: Jiaxin Wu To: edk2-devel@lists.01.org Cc: Cohen Eugene , Ye Ting , Fu Siyuan Date: Mon, 15 Aug 2016 10:46:57 +0800 Message-Id: <1471229217-7004-1-git-send-email-jiaxin.wu@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 Subject: [Patch] MdeModulePkg: Fix potential failure if UseDefaultAddress configured X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2016 02:47:00 -0000 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 Cc: Ye Ting Cc: Fu Siyuan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiaxin Wu --- MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c | 1 - 1 file changed, 1 deletion(-) diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c index f91a935..75ad301 100644 --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c @@ -148,11 +148,10 @@ Ip4Config2OnPolicyChanged ( // // Start the dhcp configuration. // if (NewPolicy == Ip4Config2PolicyDhcp) { - IpSb->Reconfig = TRUE; Ip4StartAutoConfig (&IpSb->Ip4Config2Instance); } } -- 1.9.5.msysgit.1