Re-enable interrupts only if they were enabled previously

This commit is contained in:
Rafal Kupiec 2024-05-17 23:24:04 +02:00
parent 740df726e9
commit 811b173387
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4

View File

@ -168,6 +168,10 @@ KepGetSystemResource(IN SYSTEM_RESOURCE_TYPE ResourceType,
{ {
PSYSTEM_RESOURCE_HEADER Resource; PSYSTEM_RESOURCE_HEADER Resource;
PLIST_ENTRY ListEntry; PLIST_ENTRY ListEntry;
BOOLEAN Interrupts;
/* Check if interrupts are enabled */
Interrupts = ArInterruptsEnabled();
/* Disable interrupts and acquire a spinlock */ /* Disable interrupts and acquire a spinlock */
ArClearInterruptFlag(); ArClearInterruptFlag();
@ -205,9 +209,13 @@ KepGetSystemResource(IN SYSTEM_RESOURCE_TYPE ResourceType,
Resource = NULL; Resource = NULL;
} }
/* Release spinlock and enable interrupts */ /* Release spinlock and re-enable interrupts if necessary */
KeReleaseSpinLock(&KepSystemResourcesLock); KeReleaseSpinLock(&KepSystemResourcesLock);
ArSetInterruptFlag(); if(Interrupts)
{
/* Re-enable interrupts */
ArSetInterruptFlag();
}
/* Return resource header */ /* Return resource header */
*ResourceHeader = Resource; *ResourceHeader = Resource;