]> xenbits.xensource.com Git - people/aperard/ovmf.git/commitdiff
MdeModulePkg: Add extra RestoreTpl() call in DiskIo
authorKen Lautner <kenlautner3@gmail.com>
Fri, 23 Aug 2024 22:33:55 +0000 (15:33 -0700)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Wed, 4 Sep 2024 00:53:54 +0000 (00:53 +0000)
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 <kenlautner3@gmail.com>
MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c

index 38af39f41ec25578718f7ef4bb14771386d161b1..15dfa3699fe9c7c3caccb8ebdf0f1d27e6337002 100644 (file)
@@ -847,6 +847,7 @@ DiskIo2ReadWriteDisk (
   DISK_IO_SUBTASK         *Subtask;\r
   DISK_IO2_TASK           *Task;\r
   EFI_TPL                 OldTpl;\r
+  EFI_TPL                 OldTpl1;\r
   BOOLEAN                 Blocking;\r
   BOOLEAN                 SubtaskBlocking;\r
   LIST_ENTRY              *SubtasksPtr;\r
@@ -977,7 +978,7 @@ DiskIo2ReadWriteDisk (
     }\r
   }\r
 \r
-  gBS->RaiseTPL (TPL_NOTIFY);\r
+  OldTpl1 = gBS->RaiseTPL (TPL_NOTIFY);\r
 \r
   //\r
   // Remove all the remaining subtasks when failure.\r
@@ -1012,6 +1013,7 @@ DiskIo2ReadWriteDisk (
     FreePool (Task);\r
   }\r
 \r
+  gBS->RestoreTPL (OldTpl1);\r
   gBS->RestoreTPL (OldTpl);\r
 \r
   return Status;\r