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.120; helo=mga04.intel.com; envelope-from=siyuan.fu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 CFD52211CFFCD for ; Thu, 28 Feb 2019 02:35:12 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Feb 2019 02:35:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,423,1544515200"; d="scan'208";a="127902202" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga008.fm.intel.com with ESMTP; 28 Feb 2019 02:35:06 -0800 Received: from FMSMSX110.amr.corp.intel.com (10.18.116.10) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 28 Feb 2019 02:35:02 -0800 Received: from shsmsx105.ccr.corp.intel.com (10.239.4.158) by fmsmsx110.amr.corp.intel.com (10.18.116.10) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 28 Feb 2019 02:35:01 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.134]) by SHSMSX105.ccr.corp.intel.com ([169.254.11.113]) with mapi id 14.03.0415.000; Thu, 28 Feb 2019 18:34:59 +0800 From: "Fu, Siyuan" To: "Wang, Fan" , "edk2-devel@lists.01.org" CC: "Ye, Ting" , "Wu, Jiaxin" Thread-Topic: [Patch] NetworkPkg: Fix Duplicate FreePool Error in WCM Thread-Index: AQHUz0V/OdADfxnmPU+4YWff1oHMJKX08cOA Date: Thu, 28 Feb 2019 10:34:58 +0000 Message-ID: References: <20190228091009.7096-1-fan.wang@intel.com> In-Reply-To: <20190228091009.7096-1-fan.wang@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOTQ5YzJiODYtNjhkYy00ZTVhLWE5YTMtNDhlMTlmNDczZDY2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiamhNSmx3c3ZyMEozcjJhSDJjWnMwd0RrMFhqVjlwREdQZTJ2MDU1VHpPa2FTU2FBRDZ1Q2ExZU9hUWk3eHhXNiJ9 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: Thu, 28 Feb 2019 10:35:13 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi, Fan The patch also cancel a timer in driver binding stop, please describe this = change in commit message, or separate it to another patch. Reviewed-by: Siyuan Fu > -----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, J= iaxin > > Subject: [Patch] NetworkPkg: Fix Duplicate FreePool Error in WCM >=20 > * REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1577 >=20 > 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. >=20 > This issue also exists in some other places potentially, this > patch is to fix these issues. >=20 > 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(-) >=20 > 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 ( > } >=20 > // > // Close Event > // > + gBS->SetTimer (Nic->TickTimer, TimerCancel, 0); > gBS->CloseEvent (Nic->TickTimer); >=20 > // > // Clean Supported Suites > // > diff --git a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrFileUti= l.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 { >=20 > if (Private->FileContext->FileName !=3D NULL) { > FreePool (Private->FileContext->FileName); > + Private->FileContext->FileName =3D NULL; > } > Private->FileContext->FileName =3D FileName; >=20 > if (FormId =3D=3D FORMID_ENROLL_CERT) { > HiiSetString (Private->RegisteredHandle, > diff --git > a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrHiiConfigAccess.c > b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrHiiConfigAccess.c > index bfb6b6e5ca..d0d55f46da 100644 > --- a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrHiiConfigAcces= s.c > +++ b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrHiiConfigAcces= s.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; >=20 > HiiCreateGotoOpCode ( > StartOpCodeHandle, > FORMID_CONNECT_NETWORK, > PortPromptToken, > @@ -530,10 +532,12 @@ WifiMgrRefreshNetworkList ( > goto Exit; > } > } > FreePool (AKMListDisplay); > FreePool (CipherListDisplay); > + AKMListDisplay =3D NULL; > + CipherListDisplay =3D NULL; >=20 > HiiCreateGotoOpCode ( > StartOpCodeHandle, > FORMID_CONNECT_NETWORK, > PortPromptToken, > @@ -610,10 +614,12 @@ WifiMgrRefreshNetworkList ( > AKMListDisplay, CipherListDisplay > ); > } > FreePool (AKMListDisplay); > FreePool (CipherListDisplay); > + AKMListDisplay =3D NULL; > + CipherListDisplay =3D NULL; >=20 > PortHelpToken =3D HiiSetString (Private->RegisteredHandle, 0, Port= String, > NULL); >=20 > HiiCreateGotoOpCode ( > StartOpCodeHandle, > @@ -1655,10 +1661,11 @@ WifiMgrDxeHiiConfigAccessCallback ( > Profile =3D Private->CurrentNic->UserSelectedProfile; > if (Profile->PrivateKeyData !=3D NULL) { >=20 > ZeroMem (Profile->PrivateKeyData, Profile->PrivateKeyDataSize)= ; > FreePool (Profile->PrivateKeyData); > + Profile->PrivateKeyData =3D NULL; > } >=20 > Status =3D WifiMgrReadFileToBuffer ( > Private->FileContext, > &TempData, > @@ -1698,16 +1705,18 @@ WifiMgrDxeHiiConfigAccessCallback ( > if (Private->FileType =3D=3D FileTypeCACert) { > if (Profile->CACertData !=3D NULL) { >=20 > ZeroMem (Profile->CACertData, Profile->CACertSize); > FreePool (Profile->CACertData); > + Profile->CACertData =3D NULL; > } > } else if (Private->FileType =3D=3D FileTypeClientCert) { > if (Profile->ClientCertData !=3D NULL) { >=20 > ZeroMem (Profile->ClientCertData, Profile->ClientCertSize); > FreePool (Profile->ClientCertData); > + Profile->ClientCertData =3D NULL; > } > } else { > break; > } >=20 > 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; > } > } >=20 > - FreePool (Result); > gBS->SignalEvent (Nic->Private->NetworkListRefreshEvent); >=20 > // > // 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 r= esult. > -- > 2.16.2.windows.1