public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] NetworkPkg/IScsiDxe: Fix the incorrect error handling in DriverEntryPoint
@ 2017-03-22  1:33 Jiaxin Wu
  2017-03-22  3:03 ` Zhang, Lubo
  0 siblings, 1 reply; 2+ messages in thread
From: Jiaxin Wu @ 2017-03-22  1:33 UTC (permalink / raw)
  To: edk2-devel; +Cc: Zhang Lubo, Ye Ting, Fu Siyuan, Wu Jiaxin

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 <lubo.zhang@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
---
 NetworkPkg/IScsiDxe/IScsiDriver.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/NetworkPkg/IScsiDxe/IScsiDriver.c b/NetworkPkg/IScsiDxe/IScsiDriver.c
index 269c1ae..2249919 100644
--- a/NetworkPkg/IScsiDxe/IScsiDriver.c
+++ b/NetworkPkg/IScsiDxe/IScsiDriver.c
@@ -1811,11 +1811,11 @@ IScsiDriverEntryPoint (
   //
   // Create Keywords for all the Attempts.
   //
   Status = IScsiCreateKeywords (PcdGet8 (PcdMaxIScsiAttemptNumber));
   if (EFI_ERROR (Status)) {
-    goto Error5;
+    goto Error6;
   }
 
   //
   // There should be only one EFI_AUTHENTICATION_INFO_PROTOCOL. If already exists,
   // do not produce the protocol instance.
@@ -1838,17 +1838,20 @@ IScsiDriverEntryPoint (
   }
 
   return EFI_SUCCESS;
 
 Error6:
-  IScsiConfigFormUnload (gIScsiIp4DriverBinding.DriverBindingHandle);
+  IScsiCleanAttemptVariable ();
 
 Error5:
-  IScsiCleanAttemptVariable ();
+  IScsiConfigFormUnload (gIScsiIp4DriverBinding.DriverBindingHandle);
 
 Error4:
-  FreePool (mPrivate);
+  if (mPrivate != NULL) {
+    FreePool (mPrivate);
+    mPrivate = NULL;
+  }
 
 Error3:
   gBS->UninstallMultipleProtocolInterfaces (
          ImageHandle,
          &gEfiIScsiInitiatorNameProtocolGuid,
-- 
1.9.5.msysgit.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-03-22  3:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-22  1:33 [Patch] NetworkPkg/IScsiDxe: Fix the incorrect error handling in DriverEntryPoint Jiaxin Wu
2017-03-22  3:03 ` Zhang, Lubo

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