From b17ac09cc4bb48692ec20ca583a8f70dc7d25d95 Mon Sep 17 00:00:00 2001 From: Ken Lautner Date: Fri, 23 Aug 2024 15:33:55 -0700 Subject: [PATCH] MdeModulePkg: Add extra RestoreTpl() call in DiskIo Adds a call to RestoreTpl() in DiskIo2ReadWriteDisk(). While the current implementation does not technically violate spec on raise/restore TPL, this extra call ensures symmetry between RaiseTpl and RestoreTpl calls, which makes analysis of TPL correctness simpler and permits certain non-standard TPL usages that some platforms require. Signed-off-by: Kenneth Lautner --- MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c b/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c index 38af39f41e..15dfa3699f 100644 --- a/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c +++ b/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c @@ -847,6 +847,7 @@ DiskIo2ReadWriteDisk ( DISK_IO_SUBTASK *Subtask; DISK_IO2_TASK *Task; EFI_TPL OldTpl; + EFI_TPL OldTpl1; BOOLEAN Blocking; BOOLEAN SubtaskBlocking; LIST_ENTRY *SubtasksPtr; @@ -977,7 +978,7 @@ DiskIo2ReadWriteDisk ( } } - gBS->RaiseTPL (TPL_NOTIFY); + OldTpl1 = gBS->RaiseTPL (TPL_NOTIFY); // // Remove all the remaining subtasks when failure. @@ -1012,6 +1013,7 @@ DiskIo2ReadWriteDisk ( FreePool (Task); } + gBS->RestoreTPL (OldTpl1); gBS->RestoreTPL (OldTpl); return Status;