public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Jiaxin Wu <jiaxin.wu@intel.com>
To: edk2-devel@lists.01.org
Cc: Zhang Lubo <lubo.zhang@intel.com>, Ye Ting <ting.ye@intel.com>,
	Fu Siyuan <siyuan.fu@intel.com>, Wu Jiaxin <jiaxin.wu@intel.com>
Subject: [Patch] NetworkPkg/IScsiDxe: Fix the incorrect error handling in DriverEntryPoint
Date: Wed, 22 Mar 2017 09:33:12 +0800	[thread overview]
Message-ID: <1490146392-2804-1-git-send-email-jiaxin.wu@intel.com> (raw)

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



             reply	other threads:[~2017-03-22  1:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-22  1:33 Jiaxin Wu [this message]
2017-03-22  3:03 ` [Patch] NetworkPkg/IScsiDxe: Fix the incorrect error handling in DriverEntryPoint Zhang, Lubo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1490146392-2804-1-git-send-email-jiaxin.wu@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox