* [PATCH v1 1/2] MdeModulePkg/Ip4Dxe: Uninstall protocols when error happen in Driver Binding Start.
2019-02-03 6:22 [PATCH v1 0/2] Uninstall protocols when error happen in Driver Binding Start Jiaxin Wu
@ 2019-02-03 6:22 ` Jiaxin Wu
2019-02-03 6:22 ` [PATCH v1 2/2] NetworkPkg/Ip6Dxe: " Jiaxin Wu
2019-02-11 2:58 ` [PATCH v1 0/2] " Ye, Ting
2 siblings, 0 replies; 4+ messages in thread
From: Jiaxin Wu @ 2019-02-03 6:22 UTC (permalink / raw)
To: edk2-devel; +Cc: Michael Turner, Ye Ting, Fu Siyuan, Wu Jiaxin
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1447
This patch is to uninstall Ip4ServiceBindingProtocol and Ip4Config2Protocol when
error happen in Driver Binding Start.
Cc: Michael Turner <Michael.Turner@microsoft.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Signed-off-by: Michael Turner <Michael.Turner@microsoft.com>
---
MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
index 0f25581414..87ec968e7b 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
@@ -1,9 +1,9 @@
/** @file
The driver binding and service binding protocol for IP4 driver.
-Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2005 - 2019, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -662,14 +662,17 @@ Ip4DriverBindingStart (
mIp4Id = (UINT16)NET_RANDOM (NetRandomInitSeed ());
return Status;
UNINSTALL_PROTOCOL:
- gBS->UninstallProtocolInterface (
+ gBS->UninstallMultipleProtocolInterfaces (
ControllerHandle,
&gEfiIp4ServiceBindingProtocolGuid,
- &IpSb->ServiceBinding
+ &IpSb->ServiceBinding,
+ &gEfiIp4Config2ProtocolGuid,
+ Ip4Cfg2,
+ NULL
);
FREE_SERVICE:
Ip4CleanService (IpSb);
FreePool (IpSb);
--
2.17.1.windows.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v1 2/2] NetworkPkg/Ip6Dxe: Uninstall protocols when error happen in Driver Binding Start.
2019-02-03 6:22 [PATCH v1 0/2] Uninstall protocols when error happen in Driver Binding Start Jiaxin Wu
2019-02-03 6:22 ` [PATCH v1 1/2] MdeModulePkg/Ip4Dxe: " Jiaxin Wu
@ 2019-02-03 6:22 ` Jiaxin Wu
2019-02-11 2:58 ` [PATCH v1 0/2] " Ye, Ting
2 siblings, 0 replies; 4+ messages in thread
From: Jiaxin Wu @ 2019-02-03 6:22 UTC (permalink / raw)
To: edk2-devel; +Cc: Michael Turner, Ye Ting, Fu Siyuan, Wu Jiaxin
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 <Michael.Turner@microsoft.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Signed-off-by: Michael Turner <Michael.Turner@microsoft.com>
---
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,9 +1,9 @@
/** @file
The driver binding and service binding protocol for IP6 driver.
- Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -562,20 +562,20 @@ Ip6DriverBindingStart (
&gEfiIp6ConfigProtocolGuid,
Ip6Cfg,
NULL
);
if (EFI_ERROR (Status)) {
- goto ON_ERROR;
+ goto FREE_SERVICE;
}
//
// Read the config data from NV variable again.
// The default data can be changed by other drivers.
//
Status = Ip6ConfigReadConfigData (IpSb->MacString, &IpSb->Ip6ConfigInstance);
if (EFI_ERROR (Status)) {
- goto ON_ERROR;
+ goto UNINSTALL_PROTOCOL;
}
//
// If there is any default manual address, set it.
//
@@ -586,11 +586,11 @@ Ip6DriverBindingStart (
Ip6ConfigDataTypeManualAddress,
DataItem->DataSize,
DataItem->Data.Ptr
);
if (EFI_ERROR(Status) && Status != EFI_NOT_READY) {
- goto ON_ERROR;
+ goto UNINSTALL_PROTOCOL;
}
}
//
// If there is any default gateway address, set it.
@@ -602,20 +602,20 @@ Ip6DriverBindingStart (
Ip6ConfigDataTypeGateway,
DataItem->DataSize,
DataItem->Data.Ptr
);
if (EFI_ERROR(Status)) {
- goto ON_ERROR;
+ goto UNINSTALL_PROTOCOL;
}
}
//
// ready to go: start the receiving and timer
//
Status = Ip6ReceiveFrame (Ip6AcceptFrame, IpSb);
if (EFI_ERROR (Status)) {
- goto ON_ERROR;
+ goto UNINSTALL_PROTOCOL;
}
//
// The timer expires every 100 (IP6_TIMER_INTERVAL_IN_MS) milliseconds.
//
@@ -623,11 +623,11 @@ Ip6DriverBindingStart (
IpSb->FasterTimer,
TimerPeriodic,
TICKS_PER_MS * IP6_TIMER_INTERVAL_IN_MS
);
if (EFI_ERROR (Status)) {
- goto ON_ERROR;
+ goto UNINSTALL_PROTOCOL;
}
//
// The timer expires every 1000 (IP6_ONE_SECOND_IN_MS) milliseconds.
//
@@ -635,21 +635,31 @@ Ip6DriverBindingStart (
IpSb->Timer,
TimerPeriodic,
TICKS_PER_MS * IP6_ONE_SECOND_IN_MS
);
if (EFI_ERROR (Status)) {
- goto ON_ERROR;
+ goto UNINSTALL_PROTOCOL;
}
//
// Initialize the IP6 ID
//
mIp6Id = NET_RANDOM (NetRandomInitSeed ());
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.17.1.windows.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v1 0/2] Uninstall protocols when error happen in Driver Binding Start.
2019-02-03 6:22 [PATCH v1 0/2] Uninstall protocols when error happen in Driver Binding Start Jiaxin Wu
2019-02-03 6:22 ` [PATCH v1 1/2] MdeModulePkg/Ip4Dxe: " Jiaxin Wu
2019-02-03 6:22 ` [PATCH v1 2/2] NetworkPkg/Ip6Dxe: " Jiaxin Wu
@ 2019-02-11 2:58 ` Ye, Ting
2 siblings, 0 replies; 4+ messages in thread
From: Ye, Ting @ 2019-02-11 2:58 UTC (permalink / raw)
To: Wu, Jiaxin, edk2-devel@lists.01.org; +Cc: Michael Turner, Fu, Siyuan
Series Reviewed-By: Ye Ting <ting.ye@intel.com>
-----Original Message-----
From: Wu, Jiaxin
Sent: Sunday, February 3, 2019 2:23 PM
To: edk2-devel@lists.01.org
Cc: Michael Turner <Michael.Turner@microsoft.com>; Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>
Subject: [PATCH v1 0/2] 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 <Michael.Turner@microsoft.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Signed-off-by: Michael Turner <Michael.Turner@microsoft.com>
Jiaxin Wu (2):
MdeModulePkg/Ip4Dxe: Uninstall protocols when error happen in DriverBinding Start.
NetworkPkg/Ip6Dxe: Uninstall protocols when error happen in DriverBinding Start.
MdeModulePkg//Universal/Network/Ip4Dxe/Ip4Driver.c | 9 ++++--
NetworkPkg/Ip6Dxe/Ip6Driver.c | 28 +++++++++++++------
2 files changed, 25 insertions(+), 12 deletions(-)
--
2.17.1.windows.2
^ permalink raw reply [flat|nested] 4+ messages in thread