From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0709.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe42::709]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id AE1BC1A1DFF for ; Thu, 6 Oct 2016 14:51:37 -0700 (PDT) Received: from CS1PR84MB0229.NAMPRD84.PROD.OUTLOOK.COM (10.162.190.151) by CS1PR84MB0231.NAMPRD84.PROD.OUTLOOK.COM (10.162.190.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.649.16; Thu, 6 Oct 2016 21:51:36 +0000 Received: from CS1PR84MB0229.NAMPRD84.PROD.OUTLOOK.COM ([10.162.190.151]) by CS1PR84MB0229.NAMPRD84.PROD.OUTLOOK.COM ([10.162.190.151]) with mapi id 15.01.0649.024; Thu, 6 Oct 2016 21:51:36 +0000 From: "Shah, Tapan" To: Vladimir Olovyannikov , "edk2-devel@lists.01.org" , "jaben.carsey@intel.com" CC: Vladimir Olovyannikov Thread-Topic: [PATCH] ShellPkg: Fix erroneous Status returned by ShellOpenFileByName() Thread-Index: AQHSIBs/PnKF9QaQGUmUE7MdS5DXRKCb9rWw Date: Thu, 6 Oct 2016 21:51:36 +0000 Message-ID: References: <1475790007-16365-1-git-send-email-vladimir.olovyannikov@broadcom.com> In-Reply-To: <1475790007-16365-1-git-send-email-vladimir.olovyannikov@broadcom.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=tapandshah@hpe.com; x-originating-ip: [173.172.190.106] x-ms-office365-filtering-correlation-id: 544747c9-1909-4297-6b12-08d3ee32f1f1 x-microsoft-exchange-diagnostics: 1; CS1PR84MB0231; 7:s8Wmy1x6PJHj8Dt6VW7m9Z8Ye1iW1HrE964soc61u1eEoGr7vwK+gbMpeYLCK8WM0JjYZwpr9SYVfNIuz9pwC6nkwbZvyrcogRTOyhy4zwggavf+DEksS95Wqoe/EwXe6eb2Fl9bznvqgzDn/nCVh0HCq6i9CNWdzQMuDL8gbLjjUWtyYk62fz4zmIU4x3MWa96fWgrFrKSg5PnICWq6V34aLFUFQLrsqx9evtxLtQY9KC+Fe2RkSa4ApM/vLByea2HNcQUgvoo+NvW9WM7sxgaT0oNQaMK/bCnkOT2cLjyx/TZWv7tL8UdD2r7z2RhVuwHsORHgwWsKxmh8Q2brhw== x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CS1PR84MB0231; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(227479698468861)(162533806227266)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026); SRVR:CS1PR84MB0231; BCL:0; PCL:0; RULEID:; SRVR:CS1PR84MB0231; x-forefront-prvs: 00872B689F x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6029001)(6009001)(7916002)(377454003)(199003)(13464003)(189002)(122556002)(7846002)(50986999)(54356999)(76176999)(101416001)(81156014)(81166006)(77096005)(8936002)(86362001)(305945005)(7696004)(2201001)(5002640100001)(74316002)(7736002)(2950100002)(5660300001)(92566002)(2900100001)(9686002)(8676002)(11100500001)(3280700002)(3660700001)(99286002)(106356001)(105586002)(189998001)(106116001)(97736004)(4326007)(2906002)(5001770100001)(68736007)(10400500002)(66066001)(3846002)(6116002)(586003)(87936001)(102836003)(33656002)(19580395003)(19580405001)(2501003); DIR:OUT; SFP:1102; SCL:1; SRVR:CS1PR84MB0231; H:CS1PR84MB0229.NAMPRD84.PROD.OUTLOOK.COM; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: hpe.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: hpe.com X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Oct 2016 21:51:36.2626 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-Transport-CrossTenantHeadersStamped: CS1PR84MB0231 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:51:37 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable + if (EFI_ERROR(Status)) { + return Status; + } <<<<<<<<<<<< Missing closing brace Reviewed-by: Tapan Shah -----Original Message----- From: Vladimir Olovyannikov [mailto:vladimir.olovyannikov@broadcom.com]=20 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 ShellOpenFileBy= Name() 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 Uni= codeCollationProtocol has not been located by this time, the Status gets ov= erwritten with LocateProtocol() call result, which eventually erroneously r= eturns EFI_SUCCESS to the Shell.c, and this leads to attempt to execute a n= on-existent startup script, which fails, and which in turn leads to Shell b= eing 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/Librar= y/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 =3D gEfiShellProtocol->OpenFileByName(FileName, FileHandle, OpenMode); + if (EFI_ERROR(Status)) { + return Status; =20 if (mUnicodeCollationProtocol =3D=3D NULL) { Status =3D gBS->LocateProtocol (&gEfiUnicodeCollation2ProtocolGuid, = NULL, (VOID**)&mUnicodeCollationProtocol); -- 1.9.1