From 2d6639321986653a2a604dc7fb02b76bb21c8373 Mon Sep 17 00:00:00 2001 From: Jiaxin Wu Date: Fri, 25 Jan 2019 08:53:48 +0800 Subject: [PATCH] NetworkPkg/Ip6Dxe: Uninstall protocols when error happen in Driver Binding Start. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1447 This patch is to uninstall Ip6ServiceBindingProtocol and Ip6ConfigProtocol when error happen in Driver Binding Start. Cc: Michael Turner Cc: Ye Ting Cc: Fu Siyuan Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Wu Jiaxin Signed-off-by: Michael Turner Reviewed-By: Ye Ting --- NetworkPkg/Ip6Dxe/Ip6Driver.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/NetworkPkg/Ip6Dxe/Ip6Driver.c b/NetworkPkg/Ip6Dxe/Ip6Driver.c index 0bda1687f0..4c607125a6 100644 --- a/NetworkPkg/Ip6Dxe/Ip6Driver.c +++ b/NetworkPkg/Ip6Dxe/Ip6Driver.c @@ -1,7 +1,7 @@ /** @file The driver binding and service binding protocol for IP6 driver. - Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.
This program and the accompanying materials @@ -564,7 +564,7 @@ Ip6DriverBindingStart ( NULL ); if (EFI_ERROR (Status)) { - goto ON_ERROR; + goto FREE_SERVICE; } // @@ -573,7 +573,7 @@ Ip6DriverBindingStart ( // Status = Ip6ConfigReadConfigData (IpSb->MacString, &IpSb->Ip6ConfigInstance); if (EFI_ERROR (Status)) { - goto ON_ERROR; + goto UNINSTALL_PROTOCOL; } // @@ -588,7 +588,7 @@ Ip6DriverBindingStart ( DataItem->Data.Ptr ); if (EFI_ERROR(Status) && Status != EFI_NOT_READY) { - goto ON_ERROR; + goto UNINSTALL_PROTOCOL; } } @@ -604,7 +604,7 @@ Ip6DriverBindingStart ( DataItem->Data.Ptr ); if (EFI_ERROR(Status)) { - goto ON_ERROR; + goto UNINSTALL_PROTOCOL; } } @@ -613,7 +613,7 @@ Ip6DriverBindingStart ( // Status = Ip6ReceiveFrame (Ip6AcceptFrame, IpSb); if (EFI_ERROR (Status)) { - goto ON_ERROR; + goto UNINSTALL_PROTOCOL; } // @@ -625,7 +625,7 @@ Ip6DriverBindingStart ( TICKS_PER_MS * IP6_TIMER_INTERVAL_IN_MS ); if (EFI_ERROR (Status)) { - goto ON_ERROR; + goto UNINSTALL_PROTOCOL; } // @@ -637,7 +637,7 @@ Ip6DriverBindingStart ( TICKS_PER_MS * IP6_ONE_SECOND_IN_MS ); if (EFI_ERROR (Status)) { - goto ON_ERROR; + goto UNINSTALL_PROTOCOL; } // @@ -647,7 +647,17 @@ Ip6DriverBindingStart ( return EFI_SUCCESS; -ON_ERROR: +UNINSTALL_PROTOCOL: + gBS->UninstallMultipleProtocolInterfaces ( + ControllerHandle, + &gEfiIp6ServiceBindingProtocolGuid, + &IpSb->ServiceBinding, + &gEfiIp6ConfigProtocolGuid, + Ip6Cfg, + NULL + ); + +FREE_SERVICE: Ip6CleanService (IpSb); FreePool (IpSb); return Status; -- 2.39.2