summaryrefslogtreecommitdiff
path: root/ShellPkg/Library
diff options
context:
space:
mode:
authorVladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>2016-10-06 15:02:26 -0700
committerJaben Carsey <jaben.carsey@intel.com>2016-10-07 10:35:40 -0700
commitf9c3b1b5343f53705f1ab72c55c1db440b01f36f (patch)
treef74ebb6d896ab08387b1846907b6150a5a20ecee /ShellPkg/Library
parent98e059ba16549f436e3d9e04112e9b1659da3eed (diff)
downloadedk2-platforms-f9c3b1b5343f53705f1ab72c55c1db440b01f36f.tar.xz
ShellPkg: Fix erroneous Status returned by ShellOpenFileByName()
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> Reviewed-by: Tapan Shah <tapandshah@hpe.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Diffstat (limited to 'ShellPkg/Library')
-rw-r--r--ShellPkg/Library/UefiShellLib/UefiShellLib.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
index 53f54e1746..8db18b3b21 100644
--- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c
+++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
@@ -723,6 +723,9 @@ ShellOpenFileByName(
Status = gEfiShellProtocol->OpenFileByName(FileName,
FileHandle,
OpenMode);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
if (mUnicodeCollationProtocol == NULL) {
Status = gBS->LocateProtocol (&gEfiUnicodeCollation2ProtocolGuid, NULL, (VOID**)&mUnicodeCollationProtocol);