From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web11.10424.1688077685036637840 for ; Thu, 29 Jun 2023 15:28:05 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=nytXX16L; spf=pass (domain: intel.com, ip: 134.134.136.24, mailfrom: saloni.kasbekar@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1688077685; x=1719613685; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=tHdfp7gVvAjqC2bunEAqLVJl3+boQ8sYMbFde50EkGE=; b=nytXX16Lw3Hb2S8HTeTvlzRzVuErJnvQ5I7EmVagmH6Bv2cjbLnFNXYj BtTaUHfJSXpeK2G24qfFkV7gBxHhDZ/KgGFtscY3OC1Z4IzNDXPplHoL9 QoW5a+lhRcxPKk+wm/6IIiXqYiEgyZ4jkUPokkQ4ttmcbD6P+vJrcg0F2 Em9Fm0EYDMVyUAApg6047f7hGzf7NEfv1oigGN94rd2mVZ1Rod2FmY4Fp dsgskn/3ppfdEnAlrJdvosZYwZBCJYVWYMD6f3t24l/B8Pfyg6MMlMYFv pNESh1DWpjjpixONKegEmlHPVcauNl/pxejrtD8PKyY0x+F6DmZjddcc2 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10756"; a="364824323" X-IronPort-AV: E=Sophos;i="6.01,169,1684825200"; d="scan'208";a="364824323" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2023 15:28:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10756"; a="711611580" X-IronPort-AV: E=Sophos;i="6.01,169,1684825200"; d="scan'208";a="711611580" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga007.jf.intel.com with ESMTP; 29 Jun 2023 15:28:03 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Thu, 29 Jun 2023 15:28:03 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27 via Frontend Transport; Thu, 29 Jun 2023 15:28:03 -0700 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (104.47.73.42) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.27; Thu, 29 Jun 2023 15:28:02 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CEwHBQh3Qu75ATRKwqTs6Y+o2yNTClyu1+slH3bNGEYhkKEYFc9rnOABr2r+VZdTNarx9Ka7Dpbi6a+qeUeM4fzJ3/u5UcsOoNkx/8O0M9jJgK2ErbMaTNLjZM2eImoDSBi9eCd6jQl0WgPriDbPkMroK8gvg1UntO74OFrsqxWBVbqgXGYFpTSzu3jse7PdlxBjYrMsH9KyRJlKL5Bx4l3Qk1Y4VcVLmzdWAVZ9+Y+PN6/aEqxVcJfZ8tFMWR8S8QdlneiNomL2jaoS6ISTp52UEJEwKwREKH4X0Z8wLcyI4dZnwSL+SJVmkXeZB5V0Lqdygaa3oJNOs0KwQtOqSw== 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=23gABOici3D0mIBgS+Et9JS10y8dwRGek1R3k6ooOQM=; b=aM0ttqr3getNasgoBvg2AF3wK9aMt0fcr5Y4AyWfbltKbwdAoyuwyaHemHBDk/8pcq9WbzV+r1YcmrgHcFjJFqivdVdG2AXVqv5DCmUD1Fy3YV55gaSF2qkzjTqsjnghvT9doZgfdIMFfYs45vE5S6MN3t1QxpwxgzKoYjcESI4+uh4/qY+4NbiIBMFrir4d16CaXkEt1SnnwsNxliZ0Y8GqDaeL4jnn/NKTtsmvQgecPw1mfgCJWLMNvQaftkW6meWOeMicf7TM3CpZ7xItBJBg0n7AnTXdI3+sdzIeYZmVu2TyPppkcYY0WUgZcM0P3OhXrt0wTIcCO1d2CYsIQw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from BY5PR11MB3861.namprd11.prod.outlook.com (2603:10b6:a03:18d::13) by CO6PR11MB5572.namprd11.prod.outlook.com (2603:10b6:303:13c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.26; Thu, 29 Jun 2023 22:28:00 +0000 Received: from BY5PR11MB3861.namprd11.prod.outlook.com ([fe80::5891:74e:1fc9:ba76]) by BY5PR11MB3861.namprd11.prod.outlook.com ([fe80::5891:74e:1fc9:ba76%2]) with mapi id 15.20.6544.012; Thu, 29 Jun 2023 22:28:00 +0000 From: "Saloni Kasbekar" To: Nickle Wang , "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+gO4QQgAEvnACAADfV0IABlBQQ Date: Thu, 29 Jun 2023 22:28:00 +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=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BY5PR11MB3861:EE_|CO6PR11MB5572:EE_ x-ms-office365-filtering-correlation-id: 9df553f6-a556-4122-7ed8-08db78f018d4 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: cufYRrsyE7CthAd2K2VgdCW40YqVWlIPdQZzAygL3Q4sHrAOMbvx6inGaZ7FsjQPGeCc3Ttzt4d9CBsV5tzXDu9awD5r8zKH5HUgxQVOg1DfdGoT0Qlrpp1PcRxvpqgtDGycmiQDHf/Cp1IJHcsHXVseGIX5EkzEBU+8oEloe6O/mFf7OLP7Tun/MmaVH3Kuevl2BC9/y10ntyxs+5OnyjJXTV5JNPjJQRyBbGpghvNqUIw+NEe+NcY328wkifKnOIFioFxXeWi0dklkpu8peRG1Tsyi8p6yvlArhhKbz7alVZOAG4iE9P/vjOdtAQzGPpLe2KFLISphSS7Hil1XGoI0PjKrwElwkJu7j/4EDaxJqGbStlXydh45N1GA0//2SfTAQ123zSQ/gRhtjM+vk/xAccw2xdJ2cFtr4DAT5NYtoO7MRkSXbcmk7Oo6GcBxfcCbIAVzF10bByhOkMltz3xCFeCkktaBMQ5R9Ac0ecZvNQQe4MoqONZIyjSRjF74S5C33m505T9viPxRUw7nSPNIB/6FdxRUCiYZfrF7Yjg7Ugb6yP+iiH+1oLDvL2pbq47HoNhDvQJyvqbdgpF+4vSidJTKiM3ou4mnJIs+B1j2etf/k7RaXQeuhnyznO/SwkRlh6LpV9vbqFTw0g3mugKb/ZngmZolpOCfQdA6REo= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR11MB3861.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(396003)(376002)(366004)(346002)(39860400002)(451199021)(76116006)(66946007)(64756008)(316002)(66446008)(66556008)(33656002)(66476007)(478600001)(4326008)(8936002)(52536014)(66899021)(8676002)(5660300002)(38070700005)(55016003)(86362001)(2906002)(54906003)(110136005)(41300700001)(9686003)(966005)(7696005)(53546011)(186003)(6506007)(82960400001)(71200400001)(83380400001)(122000001)(38100700002)(26005)(44824005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?hrdNr0uH93h9nufiKFe3YVbaZx9zI/fwAiSfm1M5LtuqSZ104cEbJ/k4Rv5F?= =?us-ascii?Q?jb65fGbEZdIMZWXKCVGZGVhHFmcuew5yFbmQMrLeqyYI22NonV/wEa7lkd8Q?= =?us-ascii?Q?0Ilv9istifP7Kk4CRlshgTtzKGlvSMez2Oa0vrR/7X0ZFlq3ghB4ZN9QiIkE?= =?us-ascii?Q?aa/47386oWKOi5p9NrYPyzIfVPYz/5dmnKIJMcN27i8YlqOAKjSHGQxBjOgn?= =?us-ascii?Q?2s06bbbgohjgLSb8cNzEOqeGnScuB6D+RvR2c/v5entLIo2Q+NxGp4MdtKAQ?= =?us-ascii?Q?yubVpOoKAQivnt/rbf08iy+z+RmTz/L5U97asABZ8K9zEWqqxwtNyRZkagzS?= =?us-ascii?Q?0Civ/joG/04KoW9j56uQYqtWVRM48swpe4zBwmmOf1w/BmS/lMXuHgXGLgSs?= =?us-ascii?Q?xAfDyuJQeAymQZK93jKf8obH9fpmqwvvBhfoBMDqcDqZoViBUewtzLUTYemL?= =?us-ascii?Q?m3SH7sijM8zquYmZsR6L/encxb3YtRJ0YzqJryf2xEhPtk4irb8yeXTq65S6?= =?us-ascii?Q?mN18hNT+o6W4s0pGq3MxGjh/rcDuQwwrCs/NmIuP2p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Q?s8bpvwIB6LRmGN/37AWVUnex7c4m0AUCbZjgEs4ZY04AEJxIwqosls4TsYis?= =?us-ascii?Q?8w1pvxSF8Ab/0ua/+h1fa/iF2epoSJ0ERXrwaF2dmLJMo0Xe+uLhFK2hglSC?= =?us-ascii?Q?mgWgAffpENc+7GpZuh4IY5Or/0yiD4ojcUZ1c2SY?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BY5PR11MB3861.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9df553f6-a556-4122-7ed8-08db78f018d4 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Jun 2023 22:28:00.7050 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Lv9nyOeCn8JSpg9cTN8v7CY+eITjcJQaRw4Rs7LYtl72QoINqDwuWUxTE79tL0k2AIJmFwrAi5hvfXmNFtO5mMK8ciA5gqRCNFVP5enDz/M= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR11MB5572 Return-Path: saloni.kasbekar@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Nickle, That makes sense. Thanks for the clarification. Reviewed-by: Saloni Kasbekar Thanks, Saloni -----Original Message----- From: Nickle Wang =20 Sent: Wednesday, June 28, 2023 3:30 PM 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 bindin= g start issue. 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_SERVIC= ES.InstallProtocolInterface() and the status code EFI_INVALID_PARAMETER is = returned." In this case, if we do FreePool while driver still can locate gEfiHttpServi= ceBindingProtocolGuid. Driver will access to the 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=20 > ; Abner Chang ; Igor=20 > Kulchytskyy ; Nick Ramirez > Subject: RE: [edk2-devel] [PATCH 2/2] NetworkPkg/HttpDxe: fix driver=20 > binding 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=20 > the case where we failed to install the multiple protocol interfaces=20 > and then went to ON_ERROR). Do you think it's better if we change it=20 > to - >=20 > if (HttpService !=3D NULL) { > HttpCleanService (HttpService, UsingIpv6); > Status =3D gBS->UninstallMultipleProtocolInterfaces ( > &ControllerHandle, > &gEfiHttpServiceBindingProtocolGuid, > &HttpService->ServiceBinding, > NULL > ); > if ((HttpService->Tcp4ChildHandle =3D=3D NULL) &&=20 > (HttpService->Tcp6ChildHandle =3D=3D NULL)) { > FreePool (HttpService); > } > } >=20 > Thanks, > Saloni >=20 > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Nickle=20 > Wang via groups.io > Sent: Tuesday, June 27, 2023 5:56 PM > To: devel@edk2.groups.io; Nickle Wang > Cc: Maciej Rabeda ; Siyuan Fu=20 > ; Abner Chang ; Igor=20 > Kulchytskyy ; Nick Ramirez > Subject: Re: [edk2-devel] [PATCH 2/2] NetworkPkg/HttpDxe: fix driver=20 > binding 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=20 > > Nickle Wang via groups.io > > Sent: Friday, February 10, 2023 8:34 PM > > To: devel@edk2.groups.io > > Cc: Maciej Rabeda ; Siyuan Fu=20 > > ; Abner Chang ; Igor=20 > > Kulchytskyy ; Nick Ramirez > > Subject: [edk2-devel] [PATCH 2/2] NetworkPkg/HttpDxe: fix driver=20 > > binding start issue. > > > > External email: Use caution opening links or attachments > > > > > > When failure happens in HttpDxeStart, the error handling code=20 > > release the memory buffer but it does not uninstall HTTP service=20 > > bindnig protocol. As the result, application can still locate this=20 > > 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=20 > > b/NetworkPkg/HttpDxe/HttpDriver.c index 5d918d3c4d..f6d1263cad=20 > > 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