From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.126; helo=mga18.intel.com; envelope-from=fan.wang@intel.com; receiver=edk2-devel@lists.01.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (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 0ABB321959CB2 for ; Thu, 28 Feb 2019 17:56:55 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Feb 2019 17:56:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,425,1544515200"; d="scan'208";a="137159128" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by FMSMGA003.fm.intel.com with ESMTP; 28 Feb 2019 17:56:54 -0800 Received: from fmsmsx162.amr.corp.intel.com (10.18.125.71) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 28 Feb 2019 17:56:54 -0800 Received: from shsmsx108.ccr.corp.intel.com (10.239.4.97) by fmsmsx162.amr.corp.intel.com (10.18.125.71) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 28 Feb 2019 17:56:54 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.74]) by SHSMSX108.ccr.corp.intel.com ([169.254.8.57]) with mapi id 14.03.0415.000; Fri, 1 Mar 2019 09:56:52 +0800 From: "Wang, Fan" To: "Fu, Siyuan" , "edk2-devel@lists.01.org" CC: "Ye, Ting" , "Wu, Jiaxin" Thread-Topic: [Patch] NetworkPkg: Fix Duplicate FreePool Error in WCM Thread-Index: AQHUz1FBSKaY5MUr0EGPc12MQwV/8aX2BSew Date: Fri, 1 Mar 2019 01:56:51 +0000 Message-ID: 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 01:56:56 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Thanks, Siyuan, will update commit message for this change. Best Regards Fan -----Original Message----- From: Fu, Siyuan=20 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 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 ;=20 > Wu, Jiaxin > 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=20 > device driver will be freed twice, and will cause unexpected errors,=20 > and even system crash. >=20 > This issue also exists in some other places potentially, this patch is=20 > 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=20 > + .../WifiConnectionManagerDxe/WifiConnectionMgrHiiConfigAccess.c |=20 > 9 > +++++++++ > NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrImpl.c | 1 - > 4 files changed, 11 insertions(+), 1 deletion(-) >=20 > diff --git=20 > 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=20 > 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 { >=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=20 > a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrHiiConfigAccess > .c=20 > b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrHiiConfigAccess > .c > index bfb6b6e5ca..d0d55f46da 100644 > ---=20 > a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrHiiConfigAccess > .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,=20 > 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,=20 > PortString, 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=20 > 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=20 > disconnection > // happens in Wifi FW layer, even when it is not in this time's scan r= esult. > -- > 2.16.2.windows.1