From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 64BF51A1E2A for ; Fri, 7 Oct 2016 10:36:19 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP; 07 Oct 2016 10:36:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,456,1473145200"; d="scan'208";a="1041752071" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga001.jf.intel.com with ESMTP; 07 Oct 2016 10:36:20 -0700 Received: from fmsmsx156.amr.corp.intel.com (10.18.116.74) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.248.2; Fri, 7 Oct 2016 10:36:18 -0700 Received: from fmsmsx103.amr.corp.intel.com ([169.254.2.167]) by fmsmsx156.amr.corp.intel.com ([169.254.13.152]) with mapi id 14.03.0248.002; Fri, 7 Oct 2016 10:36:18 -0700 From: "Carsey, Jaben" To: "Shah, Tapan" , Vladimir Olovyannikov , "edk2-devel@lists.01.org" CC: "Carsey, Jaben" Thread-Topic: [PATCH] ShellPkg: Fix erroneous Status returned by ShellOpenFileByName() Thread-Index: AQHSIB1bM4cuMr+BAEiPMHMrWW1Q9KCccB+AgADSOzA= Date: Fri, 7 Oct 2016 17:36:17 +0000 Message-ID: References: <1475791346-17316-1-git-send-email-vladimir.olovyannikov@broadcom.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYTFmNmY0NTEtM2MzYi00OTg3LTgwOTctOTFjMTdjNmMwN2MxIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6InlvSXRvR1JQdUZkam5MblEyQnpDRWcxQ3RYSVRxRnBTRWt1VnA4NnNYbzA9In0= x-ctpclassification: CTP_IC x-originating-ip: [10.1.200.107] MIME-Version: 1.0 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: Fri, 07 Oct 2016 17:36:19 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jaben Carsey And pushed. > -----Original Message----- > From: Shah, Tapan [mailto:tapandshah@hpe.com] > Sent: Thursday, October 06, 2016 3:04 PM > To: Vladimir Olovyannikov ; edk2- > devel@lists.01.org; Carsey, Jaben > Subject: RE: [PATCH] ShellPkg: Fix erroneous Status returned by > ShellOpenFileByName() > Importance: High >=20 > Reviewed-by: Tapan Shah >=20 >=20 > -----Original Message----- > From: Vladimir Olovyannikov [mailto:vladimir.olovyannikov@broadcom.com] > Sent: Thursday, October 06, 2016 5:02 PM > To: edk2-devel@lists.01.org; Shah, Tapan ; > jaben.carsey@intel.com > Cc: Vladimir Olovyannikov > Subject: [PATCH] ShellPkg: Fix erroneous Status returned by > ShellOpenFileByName() >=20 > In ShellOpenFileByName() the file is opened using > gEfiShellProtocol->OpenFileByName(). > It is supposed that if this call returns an EFI_ERROR, the function shoul= d > return that error immediately. However, this return was missing, and if > UnicodeCollationProtocol has not been located by this time, the Status ge= ts > overwritten with LocateProtocol() call result, which eventually erroneous= ly > 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 Shel= l being > unloaded with "Invalid parameter" > error. This patch fixes the bug. >=20 > Cc: Tapan Shah > Cc: Jaben Carsey > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Vladimir Olovyannikov > > --- > ShellPkg/Library/UefiShellLib/UefiShellLib.c | 3 +++ > 1 file changed, 3 insertions(+) >=20 > diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c > b/ShellPkg/Library/UefiShellLib/UefiShellLib.c > index 53f54e1746d4..8db18b3b210f 100644 > --- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c > +++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c > @@ -723,6 +723,9 @@ 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 >=20