From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.88; helo=mga01.intel.com; envelope-from=jiaxin.wu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 801AE2194EB75 for ; Thu, 28 Feb 2019 18:38:51 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Feb 2019 18:38:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,425,1544515200"; d="scan'208";a="127225768" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga007.fm.intel.com with ESMTP; 28 Feb 2019 18:38:51 -0800 Received: from fmsmsx120.amr.corp.intel.com (10.18.124.208) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 28 Feb 2019 18:38:50 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx120.amr.corp.intel.com (10.18.124.208) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 28 Feb 2019 18:38:50 -0800 Received: from shsmsx107.ccr.corp.intel.com ([169.254.9.252]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.134]) with mapi id 14.03.0415.000; Fri, 1 Mar 2019 10:38:48 +0800 From: "Wu, Jiaxin" To: "Wang, Fan" , "Fu, Siyuan" , "edk2-devel@lists.01.org" CC: "Ye, Ting" Thread-Topic: [Patch] NetworkPkg: Fix Duplicate FreePool Error in WCM Thread-Index: AQHUz0V/Hzo7um99GEmDGfP5EOLQT6X0fdkAgAEBkoCAAJHPoA== Date: Fri, 1 Mar 2019 02:38:47 +0000 Message-ID: <895558F6EA4E3B41AC93A00D163B727416EDAA32@SHSMSX107.ccr.corp.intel.com> References: <20190228091009.7096-1-fan.wang@intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOTQ5YzJiODYtNjhkYy00ZTVhLWE5YTMtNDhlMTlmNDczZDY2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiamhNSmx3c3ZyMEozcjJhSDJjWnMwd0RrMFhqVjlwREdQZTJ2MDU1VHpPa2FTU2FBRDZ1Q2ExZU9hUWk3eHhXNiJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch] NetworkPkg: Fix Duplicate FreePool Error in WCM X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Mar 2019 02:38:51 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Wu Jiaxin > -----Original Message----- > From: Wang, Fan > Sent: Friday, March 1, 2019 9:57 AM > To: Fu, Siyuan ; edk2-devel@lists.01.org > Cc: Ye, Ting ; Wu, Jiaxin > Subject: RE: [Patch] NetworkPkg: Fix Duplicate FreePool Error in WCM >=20 > Thanks, Siyuan, will update commit message for this change. >=20 > Best Regards > Fan >=20 > -----Original Message----- > From: Fu, Siyuan > Sent: Thursday, February 28, 2019 6:35 PM > To: Wang, Fan ; edk2-devel@lists.01.org > Cc: Ye, Ting ; Wu, Jiaxin > Subject: RE: [Patch] NetworkPkg: Fix Duplicate FreePool Error in WCM >=20 > Hi, Fan >=20 > The patch also cancel a timer in driver binding stop, please describe thi= s > change in commit message, or separate it to another patch. >=20 > Reviewed-by: Siyuan Fu >=20 > > -----Original Message----- > > From: Wang, Fan > > Sent: Thursday, February 28, 2019 5:10 PM > > To: edk2-devel@lists.01.org > > Cc: Ye, Ting ; Fu, Siyuan ; > > Wu, Jiaxin > > Subject: [Patch] NetworkPkg: Fix Duplicate FreePool Error in WCM > > > > * REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1577 > > > > In WiFi Connection Manager scan process, the result received from WiFi > > device driver will be freed twice, and will cause unexpected errors, > > and even system crash. > > > > This issue also exists in some other places potentially, this patch is > > to fix these issues. > > > > Cc: Ye Ting > > Cc: Fu Siyuan > > Cc: Wu Jiaxin > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Wang Fan > > --- > > NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrDriver.c | 1 > + > > NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrFileUtil.c | 1 > > + .../WifiConnectionManagerDxe/WifiConnectionMgrHiiConfigAccess.c | > > 9 > > +++++++++ > > NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrImpl.c | 1 > - > > 4 files changed, 11 insertions(+), 1 deletion(-) > > > > diff --git > > a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrDriver.c > > b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrDriver.c > > index 1431cdc7ea..63b0670c63 100644 > > --- a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrDriver.c > > +++ > b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrDriver.c > > @@ -409,10 +409,11 @@ WifiMgrDxeDriverBindingStop ( > > } > > > > // > > // Close Event > > // > > + gBS->SetTimer (Nic->TickTimer, TimerCancel, 0); > > gBS->CloseEvent (Nic->TickTimer); > > > > // > > // Clean Supported Suites > > // > > diff --git > > a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrFileUtil.c > > b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrFileUtil.c > > index 6db1626f2d..0224823431 100644 > > --- > a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrFileUtil.c > > +++ > b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrFileUtil.c > > @@ -251,10 +251,11 @@ UpdatePage( > > } > > } else { > > > > if (Private->FileContext->FileName !=3D NULL) { > > FreePool (Private->FileContext->FileName); > > + Private->FileContext->FileName =3D NULL; > > } > > Private->FileContext->FileName =3D FileName; > > > > if (FormId =3D=3D FORMID_ENROLL_CERT) { > > HiiSetString (Private->RegisteredHandle, diff --git > > > a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrHiiConfigAcc > ess > > .c > > > b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrHiiConfigAcc > ess > > .c > > index bfb6b6e5ca..d0d55f46da 100644 > > --- > > > a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrHiiConfigAcc > ess > > .c > > +++ > b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrHiiConfigAc > > +++ cess.c > > @@ -445,10 +445,12 @@ WifiMgrRefreshNetworkList ( > > UnicodeSPrint (PortString, PortStringSize, L"AKMSuite: %s > > CipherSuite: %s", AKMListDisplay, CipherListDisplay); > > PortHelpToken =3D HiiSetString (Private->RegisteredHandle, 0, > > PortString, NULL); > > } > > FreePool (AKMListDisplay); > > FreePool (CipherListDisplay); > > + AKMListDisplay =3D NULL; > > + CipherListDisplay =3D NULL; > > > > HiiCreateGotoOpCode ( > > StartOpCodeHandle, > > FORMID_CONNECT_NETWORK, > > PortPromptToken, > > @@ -530,10 +532,12 @@ WifiMgrRefreshNetworkList ( > > goto Exit; > > } > > } > > FreePool (AKMListDisplay); > > FreePool (CipherListDisplay); > > + AKMListDisplay =3D NULL; > > + CipherListDisplay =3D NULL; > > > > HiiCreateGotoOpCode ( > > StartOpCodeHandle, > > FORMID_CONNECT_NETWORK, > > PortPromptToken, > > @@ -610,10 +614,12 @@ WifiMgrRefreshNetworkList ( > > AKMListDisplay, CipherListDisplay > > ); > > } > > FreePool (AKMListDisplay); > > FreePool (CipherListDisplay); > > + AKMListDisplay =3D NULL; > > + CipherListDisplay =3D NULL; > > > > PortHelpToken =3D HiiSetString (Private->RegisteredHandle, 0, > > PortString, NULL); > > > > HiiCreateGotoOpCode ( > > StartOpCodeHandle, > > @@ -1655,10 +1661,11 @@ WifiMgrDxeHiiConfigAccessCallback ( > > Profile =3D Private->CurrentNic->UserSelectedProfile; > > if (Profile->PrivateKeyData !=3D NULL) { > > > > ZeroMem (Profile->PrivateKeyData, Profile->PrivateKeyDataSiz= e); > > FreePool (Profile->PrivateKeyData); > > + Profile->PrivateKeyData =3D NULL; > > } > > > > Status =3D WifiMgrReadFileToBuffer ( > > Private->FileContext, > > &TempData, > > @@ -1698,16 +1705,18 @@ WifiMgrDxeHiiConfigAccessCallback ( > > if (Private->FileType =3D=3D FileTypeCACert) { > > if (Profile->CACertData !=3D NULL) { > > > > ZeroMem (Profile->CACertData, Profile->CACertSize); > > FreePool (Profile->CACertData); > > + Profile->CACertData =3D NULL; > > } > > } else if (Private->FileType =3D=3D FileTypeClientCert) { > > if (Profile->ClientCertData !=3D NULL) { > > > > ZeroMem (Profile->ClientCertData, Profile->ClientCertSize)= ; > > FreePool (Profile->ClientCertData); > > + Profile->ClientCertData =3D NULL; > > } > > } else { > > break; > > } > > > > diff --git > > a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrImpl.c > > b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrImpl.c > > index 52ce18dfd8..9417440ac5 100644 > > --- a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrImpl.c > > +++ b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrImpl.c > > @@ -210,11 +210,10 @@ WifiMgrOnScanFinished ( > > } > > continue; > > } > > } > > > > - FreePool (Result); > > gBS->SignalEvent (Nic->Private->NetworkListRefreshEvent); > > > > // > > // The current connected network should always be available until > > disconnection > > // happens in Wifi FW layer, even when it is not in this time's scan= result. > > -- > > 2.16.2.windows.1