public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 2/2] NetworkPkg/HttpDxe: fix driver binding start issue.
@ 2023-02-10 12:34 Nickle Wang
  0 siblings, 0 replies; only message in thread
From: Nickle Wang @ 2023-02-10 12:34 UTC (permalink / raw)
  To: devel; +Cc: Maciej Rabeda, Siyuan Fu, Abner Chang, Igor Kulchytskyy,
	Nick Ramirez

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 <nicklew@nvidia.com>
Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Nick Ramirez <nramirez@nvidia.com>
---
 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.<BR>
   (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
+  Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -464,8 +465,16 @@ ON_ERROR:
 
   if (HttpService != NULL) {
     HttpCleanService (HttpService, UsingIpv6);
-    if ((HttpService->Tcp4ChildHandle == NULL) && (HttpService->Tcp6ChildHandle == NULL)) {
-      FreePool (HttpService);
+    Status = gBS->UninstallMultipleProtocolInterfaces (
+                    &ControllerHandle,
+                    &gEfiHttpServiceBindingProtocolGuid,
+                    &HttpService->ServiceBinding,
+                    NULL
+                    );
+    if (!EFI_ERROR (Status)) {
+      if ((HttpService->Tcp4ChildHandle == NULL) && (HttpService->Tcp6ChildHandle == NULL)) {
+        FreePool (HttpService);
+      }
     }
   }
 
-- 
2.39.1.windows.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-02-10 12:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-10 12:34 [PATCH 2/2] NetworkPkg/HttpDxe: fix driver binding start issue Nickle Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox