From 89648826ee0a68a24a71826e32787dc5c935b622 Mon Sep 17 00:00:00 2001 From: Jiaxin Wu Date: Wed, 22 Mar 2017 09:22:07 +0800 Subject: [PATCH] NetworkPkg/IScsiDxe: Fix the incorrect error handling in DriverEntryPoint Currently, error handling in IScsiDriverEntryPoint is incorrect. For example, if IScsiCreateAttempts() return error due to the limited max variable size, iSCSI will not unload the configuration entries. Cc: Zhang Lubo Cc: Ye Ting Cc: Fu Siyuan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin Reviewed-by: Zhang Lubo --- NetworkPkg/IScsiDxe/IScsiDriver.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/NetworkPkg/IScsiDxe/IScsiDriver.c b/NetworkPkg/IScsiDxe/IScsiDriver.c index 269c1aec5c..2249919e18 100644 --- a/NetworkPkg/IScsiDxe/IScsiDriver.c +++ b/NetworkPkg/IScsiDxe/IScsiDriver.c @@ -1813,7 +1813,7 @@ IScsiDriverEntryPoint ( // Status = IScsiCreateKeywords (PcdGet8 (PcdMaxIScsiAttemptNumber)); if (EFI_ERROR (Status)) { - goto Error5; + goto Error6; } // @@ -1840,13 +1840,16 @@ IScsiDriverEntryPoint ( return EFI_SUCCESS; Error6: - IScsiConfigFormUnload (gIScsiIp4DriverBinding.DriverBindingHandle); - -Error5: IScsiCleanAttemptVariable (); +Error5: + IScsiConfigFormUnload (gIScsiIp4DriverBinding.DriverBindingHandle); + Error4: - FreePool (mPrivate); + if (mPrivate != NULL) { + FreePool (mPrivate); + mPrivate = NULL; + } Error3: gBS->UninstallMultipleProtocolInterfaces (