NetworkPkg/HttpDxe: fix driver binding start issue.

When failure happens in HttpDxeStart, the error handling code
release the memory buffer but it does not uninstall HTTP service
binding protocol. As the result, application can still locate
this protocol and invoke service binding functions in released
memory pool.

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>
Signed-off-by: Nickle Wang <nicklew@nvidia.com>
Reviewed-by: Saloni Kasbekar <saloni.kasbekar@intel.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
This commit is contained in:
devel@edk2.groups.io 2023-02-10 04:34:03 -08:00 committed by mergify[bot]
parent a52044a9e6
commit 6510dcf6f7
1 changed files with 11 additions and 2 deletions

View File

@ -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);
}
}
}