From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw0-x235.google.com (mail-yw0-x235.google.com [IPv6:2607:f8b0:4002:c05::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id BA3241A1DFF for ; Thu, 6 Oct 2016 14:52:56 -0700 (PDT) Received: by mail-yw0-x235.google.com with SMTP id t192so1663240ywf.0 for ; Thu, 06 Oct 2016 14:52:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:references:in-reply-to:mime-version:thread-index:date :message-id:subject:to:cc; bh=ebUo8iqEB8ZJ1v2Pc3IcHhxzBWexkMVoLsddbN3lxxs=; b=U0ebRFiMnQfxL+PI3Tv2DnwxI0+UdlTgC2sNLitzcfZCmmrjzizXp6bhTZuPKzqkPw CNlOIsY6cz4p2etzXct4EuG9Qb/1pBFnRU/3XKr0BrNa6l6K+XaRpTa4jPk8djgJ6xFe H1ZMFKJ2TW00Q9WpNqUyydjw9Aeu0crNf3pAs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:references:in-reply-to:mime-version :thread-index:date:message-id:subject:to:cc; bh=ebUo8iqEB8ZJ1v2Pc3IcHhxzBWexkMVoLsddbN3lxxs=; b=g+OvMtvEGJAqVLUDsqL2VNDwTFUqwjYi8VCWKjypCn63w7TfrZwXIPd2UgS9w/5ZdB URCvdxOUM1TCA1seWDD2QdL6ELss9pSdThKRgk8JQEVQtG7uAi1PKsrkYHnSBmGBdcsp iOBM9vhjLOjZASnsSurg0UVNkCrqIwvivBjABoP+bUf+jkWJfAMdCtfs+KDdsMb39T7Q ks4GTW+K0fn8Xf/koqU1QkFeuqx8I6vCGgy6a/PNcTZ78UBSDyngNdFXhv2gNP12t7zF Thm/2PnBs1mw7pCThjHiSDG7YQBdATfyVhkjj/5i21ZTIInZjnB4lqkLzNoPbekzmqJs 6yYQ== X-Gm-Message-State: AA6/9RkR7+Xwr8KFNZe+eFESgsFePXyNsO0bnG8FoplZStowtAP+Bfi0WY//QnHHCy2jLXV/UN1xuirAXI+p8vB1 X-Received: by 10.13.225.148 with SMTP id k142mr1674417ywe.183.1475790775785; Thu, 06 Oct 2016 14:52:55 -0700 (PDT) From: Vladimir Olovyannikov References: <1475790007-16365-1-git-send-email-vladimir.olovyannikov@broadcom.com> In-Reply-To: MIME-Version: 1.0 X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQHjGELqP3vfABMGUuh25fP0bmvAWwL8qegmoGIiA9A= Date: Thu, 6 Oct 2016 14:52:53 -0700 Message-ID: To: "Shah, Tapan" , edk2-devel@lists.01.org, jaben.carsey@intel.com Cc: Vladimir Olovyannikov Subject: Re: [PATCH] ShellPkg: Fix erroneous Status returned by ShellOpenFileByName() X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Oct 2016 21:52:57 -0000 Content-Type: text/plain; charset=UTF-8 -----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 -----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 ; jaben.carsey@intel.com Cc: Vladimir Olovyannikov ; Vladimir Olovyannikov Subject: [PATCH] ShellPkg: Fix erroneous Status returned by ShellOpenFileByName() From: Vladimir Olovyannikov 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 Cc: Jaben Carsey Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Vladimir Olovyannikov --- 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