diff options
author | Wang Fan <fan.wang@intel.com> | 2018-01-08 13:14:43 +0800 |
---|---|---|
committer | Jiaxin Wu <jiaxin.wu@intel.com> | 2018-01-10 08:30:18 +0800 |
commit | 39b0867d836292be0ffaffd2cc1edb7049c9fddd (patch) | |
tree | e93b80900ee802af9f85c40cf521e95e6b8db3c0 | |
parent | 523152618d20a58c9ad55203fa6e5b8bebe938f0 (diff) | |
download | edk2-39b0867d836292be0ffaffd2cc1edb7049c9fddd.tar.gz edk2-39b0867d836292be0ffaffd2cc1edb7049c9fddd.tar.bz2 edk2-39b0867d836292be0ffaffd2cc1edb7049c9fddd.zip |
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>
-rw-r--r-- | MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c index 54384e143e..f5f9e6d8f7 100644 --- a/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c +++ b/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c @@ -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:
|