From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (NAM02-BN1-obe.outbound.protection.outlook.com [40.107.212.57]) by mx.groups.io with SMTP id smtpd.web10.2647.1687991386524808402 for ; Wed, 28 Jun 2023 15:29:46 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nvidia.com header.s=selector2 header.b=kvGolGJ9; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: nvidia.com, ip: 40.107.212.57, mailfrom: nicklew@nvidia.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H2RUAkePIhidV/7Lc5wJDy38QYZCRf9HOhlO2WS1/dWNFu/FJ1ODGHlUkuTaI0dOv+FjfSX0PsewusxzHPRUnVnSe1EASXoQCg30j9PO5SXD40JK9Rx1rFjq7LzXd1iNb3SIgGf2lAkA6Kt2yII1TUSRmBfggsVldXKwl5hlcSA5HtSM5S5bTE9zteiNmitZjZ/BuQlseUePdDk4TuP/ZgZb98o6/D3lJsjOWMBMrZ4jNrAGSEu4CppXOah7hb+810TSK9UgqlkyfZSAGVtJJJQHBoLhQDj5UNSOyLBMBVYXXpIQXbntpixXVWCQue28YehMtW0DK6vQ5hT5Y/9eYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wCMZ+9sni3yoqWVV3DFVzjeBmnhKjJ7vqCNaS8ok8+U=; b=JY2KOxmj9k3k6lW2falVe7mmWZbWWgRA+1ekrXKAH34enHM1CmNtBBmeVvqzhognuO3uHWhmCQyCoOG4SG0BBPeAUZthIrL1Ut5PyT5jJ9Bm4hqq/RQNH1buj6rc86hwNTvwT4nqVp4j8XNm66APetRAPBXIOxsk6dlkWqlv/FyD6nWo0A1ejjbYZPR8ybqWKbs7ghkG8ZOGwQwbZo14sctwhws1CEQa9B0t6O+OGbKuVEETM1nFbvzNEdmAZkXlXVz2CYD28fehXJaqaD3RFVFXAOu3TyW03VWhTDxfKOjMMWeMILV2wi2imTFGbqx3U2PJW8E/cpieWI/nMO7xRQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wCMZ+9sni3yoqWVV3DFVzjeBmnhKjJ7vqCNaS8ok8+U=; b=kvGolGJ9NOaOA4bWdKmi15rWRVuABDzNl0tJX9I9EfDJ80+DIhv9XLeiDlTDaC2g8RTnqSFmya+4XdN3CjN17yhVwIx3W+iLn18A0l0m77oZllMuV0yUOauIcLg4CvFr3P/bgIeMy7pcZTkxUbfikcIojy+xtnXfDOnoY1T0s5U639MizLoG1+aONu6cqbUrj+/c9srOXqfSChqS7n6F7QBWWWQ4DtKwIRPiMQv658T4Dfjvn6e4/IcOHbSjS35zZZRad9dOpApKodraVJpT1twN5yRgDr5viAPuNzqIcD4/EtQDbQlZjxzztTdh/6JIBbIlVwHJOZQKFbWtn/Q85Q== Received: from MW4PR12MB7031.namprd12.prod.outlook.com (2603:10b6:303:1ef::6) by CH0PR12MB5249.namprd12.prod.outlook.com (2603:10b6:610:d0::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Wed, 28 Jun 2023 22:29:42 +0000 Received: from MW4PR12MB7031.namprd12.prod.outlook.com ([fe80::820f:3158:c86f:9bca]) by MW4PR12MB7031.namprd12.prod.outlook.com ([fe80::820f:3158:c86f:9bca%7]) with mapi id 15.20.6500.026; Wed, 28 Jun 2023 22:29:41 +0000 From: "Nickle Wang" To: "Kasbekar, Saloni" , "devel@edk2.groups.io" CC: Maciej Rabeda , Siyuan Fu , Abner Chang , Igor Kulchytskyy , Nick Ramirez Subject: Re: [edk2-devel] [PATCH 2/2] NetworkPkg/HttpDxe: fix driver binding start issue. Thread-Topic: [edk2-devel] [PATCH 2/2] NetworkPkg/HttpDxe: fix driver binding start issue. Thread-Index: AQHZPUwAuV9WkswkYkek1DFyHKnaxa+gO4QQgAEvnACAADfV0A== Date: Wed, 28 Jun 2023 22:29:41 +0000 Message-ID: References: <174276A45CE2816B.5513@groups.io> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MW4PR12MB7031:EE_|CH0PR12MB5249:EE_ x-ms-office365-filtering-correlation-id: cbcc9f46-ec07-4661-ff90-08db78272a46 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Z9u+h+04mzLP9hbAoFgDv1qOvHZ80Px2nxAywqsToCBP5CtzYV2DQJEFm4GBXonnmeAX8zN8a5ia2T1xpQLccyJLCkW+IfmQDefWU/1oHOhgx55qbMe+Dx0Je2w2R3O/wB1ezD5UiRLbztdndXVDKjy8fEFk0mGubN4HXmu3NOx7kBshNh70VV6+skZbmFH3229SUMJT4fvSmFfMFDwK+75uJSmWulZcuwp1m0Zkuc3gf3LdUgc6wHEXLoLfTbKeV5W5RZNUGzs5wUq8kUsMFW6yTuUnGu+mAEjMq7f2h7jUFahlIe1d+zC8Y2L3PD0f9wmyF5dE79bWrektiTYtCBrUFMfcY/e/kx+15CEZnBB0qiJZCoNhSmbc9gE+/jARYYaLRZmA5HPhmxPn5hRBVNTvVIUHe66S9j+/IosKCgErqFxDdzmrJk0HpTAXOV/pujfErJJefa8bvKvz6W0EAnbTTjsKHeAtGBjZ6GHCi6/Mfez0WOgb1MdGY/P4JCMcIYpLHhfa+pbHlm7EQof7F8P4NVzSmA3lt7MhU6NamUsiWja88ir6eQMhdPR1vtdP3KK9VlScO7TVlQAUPbk1YckCYcmuMOSc6XO88vo+7GbNR146zY85rVu/6/Om8zbQ x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW4PR12MB7031.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(136003)(396003)(376002)(346002)(366004)(39860400002)(451199021)(53546011)(6506007)(107886003)(966005)(478600001)(71200400001)(54906003)(110136005)(83380400001)(2906002)(186003)(7696005)(9686003)(86362001)(64756008)(316002)(5660300002)(52536014)(33656002)(66476007)(122000001)(76116006)(66946007)(8676002)(4326008)(41300700001)(38100700002)(38070700005)(8936002)(55016003)(66446008)(66556008)(66899021)(44824005);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?0AeY81KAZZyFxbqE7sMfrACdP85HcT4xOArNcJkHL24WLEM32wyBHDGRt/rJ?= =?us-ascii?Q?pVhzKSEQH43S3WpDS9s4rmxeXNAIJres9LWoRKWgEsPmvfQRWRVvHU+YaLlp?= =?us-ascii?Q?YDXqTHB5sa0jpxg79V/4LiSRNoAPnNxKwskkVGlRcct/66SjzTCv8AyqFq4B?= =?us-ascii?Q?Eq3XRftWEl6Lw1gcTDOj9yGW0xiCWhkWzy65HRp8XW9qzM8JIK7EDu4UooE0?= =?us-ascii?Q?2n0YTSErGgRmyx7F5+DcPfkwkTWcf++Chgwi51811frDIDqk7I8W7+Rptrqz?= =?us-ascii?Q?/VrFi7LZzp07v9hpuoakWuZPLrjvKXNmGVKzD/OTb+FyZrYtuAQIfN7x8Q4k?= =?us-ascii?Q?xJnS2UyGqzEbH4ay0urx6dXrpIxSc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ZCqEKQaKRRW0V3xTeaKKb9o04VvVGCH3gLEF/7HlqHhIp8CVYIfve?= =?us-ascii?Q?0MrLrgaHYtRc9/vn2hncWZKY781Wsd094pdl3cM0hxAWSFLuSns2YGeXALho?= =?us-ascii?Q?Ea38UIG0R7O7i3ZYl73LBPzvPn8USwRur3+W1tjYVgmzfUCHB1a+Qob3PImQ?= =?us-ascii?Q?6deMhcX140bykOmrfHrJNx+BGYwmTbBoDomy1PK4ODt9bDfO/kSIOBIddw/E?= =?us-ascii?Q?r2ecq4CaWI9n1sSkIwSKZZqdDAOBwlJCcBp55FIPAQkQ0YsalNyUzE1NCAdd?= =?us-ascii?Q?9hUDu7MvQsO2iZIn16JKwTfnOC1CvIoKRUnCBqVo0gDok0xexfdycGQ4DFuW?= =?us-ascii?Q?yMz12mjDdaCWssNjwv0zRSvqo84zRtZIUu6c0k25WSJt?= MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW4PR12MB7031.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: cbcc9f46-ec07-4661-ff90-08db78272a46 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Jun 2023 22:29:41.1288 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: sQWaOndHK6Vrv5PCbv8vQDbL7povv3o9jzG/qAaa6rBHKNz5/SX8mHkbmHN6txkgf9IaMq0hNzqAK0UN2EiRBg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5249 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Saloni, Thanks for your review.=20 When uninstall fails, per UEFI specification, the protocol will be installe= d again and will be visible to UEFI drivers. Page 190, UEFI spec. 2.10: "If any errors are generated while the protocol interfaces are being uninstalled, then the protocols uninstalled p= rior to the error will be reinstalled with the boot service EFI_BOOT_SERVICES.InstallProtocolInterface() and the status co= de EFI_INVALID_PARAMETER is returned." In this case, if we do FreePool while driver still can locate gEfiHttpServi= ceBindingProtocolGuid. Driver will access to the=20 memory that is released to system. Memory issue may happen. Regards, Nickle > -----Original Message----- > From: Kasbekar, Saloni > Sent: Thursday, June 29, 2023 3:07 AM > To: devel@edk2.groups.io; Nickle Wang > Cc: Maciej Rabeda ; Siyuan Fu > ; Abner Chang ; Igor Kulchytsky= y > ; Nick Ramirez > Subject: RE: [edk2-devel] [PATCH 2/2] NetworkPkg/HttpDxe: fix driver bind= ing > start issue. >=20 > External email: Use caution opening links or attachments >=20 >=20 > Hi Nickle, >=20 > We would want to do the FreePool even if the Uninstall fails (like in the= case > where we failed to install the multiple protocol interfaces and then went= to > ON_ERROR). Do you think it's better if we change it to - >=20 > if (HttpService !=3D NULL) { > HttpCleanService (HttpService, UsingIpv6); > Status =3D gBS->UninstallMultipleProtocolInterfaces ( > &ControllerHandle, > &gEfiHttpServiceBindingProtocolGuid, > &HttpService->ServiceBinding, > NULL > ); > if ((HttpService->Tcp4ChildHandle =3D=3D NULL) && (HttpService->Tcp6C= hildHandle > =3D=3D NULL)) { > FreePool (HttpService); > } > } >=20 > Thanks, > Saloni >=20 > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Nickle Wan= g > via groups.io > Sent: Tuesday, June 27, 2023 5:56 PM > To: devel@edk2.groups.io; Nickle Wang > Cc: Maciej Rabeda ; Siyuan Fu > ; Abner Chang ; Igor Kulchytsky= y > ; Nick Ramirez > Subject: Re: [edk2-devel] [PATCH 2/2] NetworkPkg/HttpDxe: fix driver bind= ing > start issue. >=20 > May I know if someone can help to review this patch? >=20 > Thanks, > Nickle >=20 > > -----Original Message----- > > From: devel@edk2.groups.io On Behalf Of Nickle > > Wang via groups.io > > Sent: Friday, February 10, 2023 8:34 PM > > To: devel@edk2.groups.io > > Cc: Maciej Rabeda ; Siyuan Fu > > ; Abner Chang ; Igor > > Kulchytskyy ; Nick Ramirez > > Subject: [edk2-devel] [PATCH 2/2] NetworkPkg/HttpDxe: fix driver > > binding start issue. > > > > External email: Use caution opening links or attachments > > > > > > When failure happens in HttpDxeStart, the error handling code release > > the memory buffer but it does not uninstall HTTP service bindnig > > protocol. As the result, application can still locate this protocol > > and invoke service binding fucntions in released memory pool. > > > > Signed-off-by: Nickle Wang > > Cc: Maciej Rabeda > > Cc: Siyuan Fu > > Cc: Abner Chang > > Cc: Igor Kulchytskyy > > Cc: Nick Ramirez > > --- > > NetworkPkg/HttpDxe/HttpDriver.c | 13 +++++++++++-- > > 1 file changed, 11 insertions(+), 2 deletions(-) > > > > diff --git a/NetworkPkg/HttpDxe/HttpDriver.c > > b/NetworkPkg/HttpDxe/HttpDriver.c index 5d918d3c4d..f6d1263cad 100644 > > --- a/NetworkPkg/HttpDxe/HttpDriver.c > > +++ b/NetworkPkg/HttpDxe/HttpDriver.c > > @@ -3,6 +3,7 @@ > > > > Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved. > > (C) Copyright 2016 Hewlett Packard Enterprise Development LP
> > + Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights rese= rved. > > > > SPDX-License-Identifier: BSD-2-Clause-Patent > > > > @@ -464,8 +465,16 @@ ON_ERROR: > > > > if (HttpService !=3D NULL) { > > HttpCleanService (HttpService, UsingIpv6); > > - if ((HttpService->Tcp4ChildHandle =3D=3D NULL) && (HttpService- > > >Tcp6ChildHandle =3D=3D NULL)) { > > - FreePool (HttpService); > > + Status =3D gBS->UninstallMultipleProtocolInterfaces ( > > + &ControllerHandle, > > + &gEfiHttpServiceBindingProtocolGuid, > > + &HttpService->ServiceBinding, > > + NULL > > + ); > > + if (!EFI_ERROR (Status)) { > > + if ((HttpService->Tcp4ChildHandle =3D=3D NULL) && (HttpService- > > >Tcp6ChildHandle =3D=3D NULL)) { > > + FreePool (HttpService); > > + } > > } > > } > > > > -- > > 2.39.1.windows.1 > > > > > > > > > > >=20 >=20 >=20 >=20 >=20