MdeModulePkg: Fixed two issues when error occurs in Mtftp4Start.

* 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.

Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wang Fan <fan.wang@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
This commit is contained in:
Wang Fan 2018-01-08 13:14:43 +08:00 committed by Jiaxin Wu
parent 523152618d
commit 39b0867d83
1 changed files with 12 additions and 8 deletions

View File

@ -2,7 +2,7 @@
Interface routine for Mtftp4.
(C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>
Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@ -409,6 +409,12 @@ Mtftp4Start (
return Status;
}
if ((Token->OverrideData != NULL) && !Mtftp4OverrideValid (Instance, Token->OverrideData)) {
Status = EFI_INVALID_PARAMETER;
gBS->RestoreTPL (OldTpl);
return Status;
}
//
// Set the Operation now to prevent the application start other
// operations.
@ -416,11 +422,6 @@ Mtftp4Start (
Instance->Operation = Operation;
Override = Token->OverrideData;
if ((Override != NULL) && !Mtftp4OverrideValid (Instance, Override)) {
Status = EFI_INVALID_PARAMETER;
goto ON_ERROR;
}
if (Token->OptionCount != 0) {
Status = Mtftp4ParseOption (
Token->OptionList,
@ -430,6 +431,7 @@ Mtftp4Start (
);
if (EFI_ERROR (Status)) {
Status = EFI_DEVICE_ERROR;
goto ON_ERROR;
}
}
@ -484,6 +486,7 @@ Mtftp4Start (
Status = Mtftp4ConfigUnicastPort (Instance->UnicastPort, Instance);
if (EFI_ERROR (Status)) {
Status = EFI_DEVICE_ERROR;
goto ON_ERROR;
}
@ -501,13 +504,13 @@ Mtftp4Start (
Status = Mtftp4RrqStart (Instance, Operation);
}
gBS->RestoreTPL (OldTpl);
if (EFI_ERROR (Status)) {
Status = EFI_DEVICE_ERROR;
goto ON_ERROR;
}
if (Token->Event != NULL) {
gBS->RestoreTPL (OldTpl);
return EFI_SUCCESS;
}
@ -519,6 +522,7 @@ Mtftp4Start (
This->Poll (This);
}
gBS->RestoreTPL (OldTpl);
return Token->Status;
ON_ERROR: