Skip to content

Commit

Permalink
Fix Synchronous Exception on Windows Developer Kit 2023
Browse files Browse the repository at this point in the history
* Per pbatard/uefi-ntfs#37 the UEFI driver crashed during load on some
  ARM64 based systems.
* This appears to be due to Windows Dev Kit UEFI firmware instantiating
  the file system protocols before FSInstall() has returned, with the
  consequence of this being that InsertTailList() in NtfsMountVolume()
  was being called before InitializeListHead() had been called, leading
  to a null-pointer dereference.
* Fix this by making sure that InitializeListHead() is called before we
  instantiate the protocols.
  • Loading branch information
pbatard committed May 24, 2023
1 parent 5e40d87 commit 597535f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions uefi-driver/uefi_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,9 @@ FSInstall(EFI_FS* This, EFI_HANDLE ControllerHandle)

PrintInfo(L"FSInstall: %s\n", This->DevicePathString);

/* FsListHead must be initialized before we install the protocol */
InitializeListHead(&FsListHead);

/* Install the simple file system protocol. */
Status = gBS->InstallMultipleProtocolInterfaces(&ControllerHandle,
&gEfiSimpleFileSystemProtocolGuid, &This->FileIoInterface,
Expand All @@ -846,8 +849,6 @@ FSInstall(EFI_FS* This, EFI_HANDLE ControllerHandle)
return Status;
}

InitializeListHead(&FsListHead);

return EFI_SUCCESS;
}

Expand Down

0 comments on commit 597535f

Please sign in to comment.