public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
To: "Shah, Tapan" <tapandshah@hpe.com>,
	edk2-devel@lists.01.org, 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 14:52:53 -0700	[thread overview]
Message-ID: <f78188c6e85b3dec85a78cd5db57229d@mail.gmail.com> (raw)
In-Reply-To: <CS1PR84MB0229AB8E1D5EE9026008E724D4C70@CS1PR84MB0229.NAMPRD84.PROD.OUTLOOK.COM>

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

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


Right. Please disregard this, will resubmit.

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:52 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
2016-10-06 21:52   ` Vladimir Olovyannikov [this message]
  -- 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=f78188c6e85b3dec85a78cd5db57229d@mail.gmail.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