From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=siyuan.fu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (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 CD20E21F833B9 for ; Mon, 8 Jan 2018 22:53:42 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jan 2018 22:58:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,334,1511856000"; d="scan'208";a="193468998" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga006.fm.intel.com with ESMTP; 08 Jan 2018 22:58:52 -0800 Received: from fmsmsx151.amr.corp.intel.com (10.18.125.4) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 8 Jan 2018 22:58:52 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX151.amr.corp.intel.com (10.18.125.4) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 8 Jan 2018 22:58:51 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.93]) with mapi id 14.03.0319.002; Tue, 9 Jan 2018 14:58:49 +0800 From: "Fu, Siyuan" To: "Wang, Fan" , "edk2-devel@lists.01.org" CC: "Wu, Jiaxin" , "Ye, Ting" Thread-Topic: [Patch 1/2] MdeModulePkg: Fixed two issues when error occurs in Mtftp4Start. Thread-Index: AQHTiOfkNsggF3xDFEea3L39wKdjHKNrHL4w Date: Tue, 9 Jan 2018 06:58:49 +0000 Message-ID: References: <1515460747-8372-1-git-send-email-fan.wang@intel.com> <1515460747-8372-2-git-send-email-fan.wang@intel.com> In-Reply-To: <1515460747-8372-2-git-send-email-fan.wang@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZDU4NzAwNGEtY2YxOC00MmIxLWIxMjktMGVhMWU0MDZlNGFlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiJtSlFcL282Q0pKZFptYXRWcm5DZjZTZE9mM05MYndJTGpkRDkwUGh0QVplckljT3BKeWlybGdpSmR2Tkx1UG4wUyJ9 dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch 1/2] MdeModulePkg: Fixed two issues when error occurs in Mtftp4Start. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 06:53:43 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Fu Siyuan > -----Original Message----- > From: Wang, Fan > Sent: Tuesday, January 9, 2018 9:19 AM > To: edk2-devel@lists.01.org > Cc: Wu, Jiaxin ; Ye, Ting ; Fu, > Siyuan > Subject: [Patch 1/2] MdeModulePkg: Fixed two issues when error occurs in > Mtftp4Start. >=20 > * This function sets returned status as token status and signal token > when error occurs, and it results token status not compliance with > spec definition. This patch fixed this issue. > * This function restore Tpl twice when Mtftp4WrqStart() returns an > error, this patch fixed this issue. >=20 > Cc: Jiaxin Wu > Cc: Ye Ting > Cc: Fu Siyuan > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Wang Fan > --- > .../Universal/Network/Mtftp4Dxe/Mtftp4Impl.c | 20 ++++++++++++--= - > ----- > 1 file changed, 12 insertions(+), 8 deletions(-) >=20 > diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c > b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c > index 54384e1..f5f9e6d 100644 > --- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c > +++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c > @@ -1,10 +1,10 @@ > /** @file > Interface routine for Mtftp4. >=20 > (C) Copyright 2014 Hewlett-Packard Development Company, L.P.
> -Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
> +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
> This program and the accompanying materials > are licensed and made available under the terms and conditions of the BS= D > License > which accompanies this distribution. The full text of the license may b= e > found at > http://opensource.org/licenses/bsd-license.php
>=20 > @@ -407,31 +407,33 @@ Mtftp4Start ( > if (EFI_ERROR (Status)) { > gBS->RestoreTPL (OldTpl); > return Status; > } >=20 > + if ((Token->OverrideData !=3D NULL) && !Mtftp4OverrideValid (Instance, > Token->OverrideData)) { > + Status =3D EFI_INVALID_PARAMETER; > + gBS->RestoreTPL (OldTpl); > + return Status; > + } > + > // > // Set the Operation now to prevent the application start other > // operations. > // > Instance->Operation =3D Operation; > Override =3D Token->OverrideData; >=20 > - if ((Override !=3D NULL) && !Mtftp4OverrideValid (Instance, Override))= { > - Status =3D EFI_INVALID_PARAMETER; > - goto ON_ERROR; > - } > - > if (Token->OptionCount !=3D 0) { > Status =3D Mtftp4ParseOption ( > Token->OptionList, > Token->OptionCount, > TRUE, > &Instance->RequestOption > ); >=20 > if (EFI_ERROR (Status)) { > + Status =3D EFI_DEVICE_ERROR; > goto ON_ERROR; > } > } >=20 > // > @@ -482,10 +484,11 @@ Mtftp4Start ( > // Config the unicast UDP child to send initial request > // > Status =3D Mtftp4ConfigUnicastPort (Instance->UnicastPort, Instance); >=20 > if (EFI_ERROR (Status)) { > + Status =3D EFI_DEVICE_ERROR; > goto ON_ERROR; > } >=20 > // > // Set initial status. > @@ -499,17 +502,17 @@ Mtftp4Start ( > Status =3D Mtftp4WrqStart (Instance, Operation); > } else { > Status =3D Mtftp4RrqStart (Instance, Operation); > } >=20 > - gBS->RestoreTPL (OldTpl); > - > if (EFI_ERROR (Status)) { > + Status =3D EFI_DEVICE_ERROR; > goto ON_ERROR; > } >=20 > if (Token->Event !=3D NULL) { > + gBS->RestoreTPL (OldTpl); > return EFI_SUCCESS; > } >=20 > // > // Return immediately for asynchronous operation or poll the > @@ -517,10 +520,11 @@ Mtftp4Start ( > // > while (Token->Status =3D=3D EFI_NOT_READY) { > This->Poll (This); > } >=20 > + gBS->RestoreTPL (OldTpl); > return Token->Status; >=20 > ON_ERROR: > Mtftp4CleanOperation (Instance, Status); > gBS->RestoreTPL (OldTpl); > -- > 1.9.5.msysgit.1