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 <[email protected]>
Cc: Ye Ting <[email protected]>
Cc: Fu Siyuan <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wang Fan <[email protected]>
Reviewed-by: Fu Siyuan <[email protected]>
Reviewed-by: Jiaxin Wu <[email protected]>
This commit is contained in:
Wang Fan authored and Jiaxin Wu committed 2018-01-10 08:30:18 +08:00
1 parent 523152618d
commit 39b0867d83
1 file changed
+12 -8
@@ -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: