public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Shah, Tapan" <tapandshah@hpe.com>
To: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
	"jaben.carsey@intel.com" <jaben.carsey@intel.com>
Cc: Vladimir Olovyannikov <volovyan@broadcom.com>
Subject: Re: [PATCH] ShellPkg: Fix erroneous Status returned by ShellOpenFileByName()
Date: Thu, 6 Oct 2016 21:51:36 +0000	[thread overview]
Message-ID: <CS1PR84MB0229AB8E1D5EE9026008E724D4C70@CS1PR84MB0229.NAMPRD84.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <1475790007-16365-1-git-send-email-vladimir.olovyannikov@broadcom.com>

+    if (EFI_ERROR(Status)) {
+      return Status;
+    } <<<<<<<<<<<< Missing closing brace

Reviewed-by: Tapan Shah <tapandshah@hpe.com>

-----Original Message-----
From: Vladimir Olovyannikov [mailto:vladimir.olovyannikov@broadcom.com] 
Sent: Thursday, October 06, 2016 4:40 PM
To: edk2-devel@lists.01.org; Shah, Tapan <tapandshah@hpe.com>; jaben.carsey@intel.com
Cc: Vladimir Olovyannikov <volovyan@broadcom.com>; Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
Subject: [PATCH] ShellPkg: Fix erroneous Status returned by ShellOpenFileByName()

From: Vladimir Olovyannikov <volovyan@broadcom.com>

In ShellOpenFileByName() the file is opened using
gEfiShellProtocol->OpenFileByName().
It is supposed that if this call returns an EFI_ERROR, the function should return that error immediately. However, this return was missing, and if UnicodeCollationProtocol has not been located by this time, the Status gets overwritten with LocateProtocol() call result, which eventually erroneously returns EFI_SUCCESS to the Shell.c, and this leads to attempt to execute a non-existent startup script, which fails, and which in turn leads to Shell being unloaded with "Invalid parameter"
error. This patch fixes the bug.

Cc: Tapan Shah <tapandshah@hpe.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
---
 ShellPkg/Library/UefiShellLib/UefiShellLib.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
index 53f54e1746d4..6fa67a3e751c 100644
--- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c
+++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
@@ -723,6 +723,8 @@ ShellOpenFileByName(
     Status = gEfiShellProtocol->OpenFileByName(FileName,
                                                FileHandle,
                                                OpenMode);
+    if (EFI_ERROR(Status)) {
+      return Status;
 
     if (mUnicodeCollationProtocol == NULL) {
       Status = gBS->LocateProtocol (&gEfiUnicodeCollation2ProtocolGuid, NULL, (VOID**)&mUnicodeCollationProtocol);
--
1.9.1



  reply	other threads:[~2016-10-06 21:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-06 21:40 [PATCH] ShellPkg: Fix erroneous Status returned by ShellOpenFileByName() Vladimir Olovyannikov
2016-10-06 21:51 ` Shah, Tapan [this message]
2016-10-06 21:52   ` Vladimir Olovyannikov
  -- strict thread matches above, loose matches on Subject: below --
2016-10-06 22:02 Vladimir Olovyannikov
2016-10-06 22:03 ` Shah, Tapan
2016-10-07 17:36   ` Carsey, Jaben

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=CS1PR84MB0229AB8E1D5EE9026008E724D4C70@CS1PR84MB0229.NAMPRD84.PROD.OUTLOOK.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