Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
fallback: find_boot_option() needs to return the index for the boot e…
…ntry in optnum The CopyMem() calls in add_to_boot_list() expect that find_boot_option() returned an index to the matching entry in the BootOrder array. The previous code returned the numerical portion of the boot entry label, which in some cases resulted in -1 * sizeof(CHAR16) being passed to CopyMem() which would in turn corrupt the running firmware resulting in an exception and a failure to boot or reset.
- Loading branch information
1b30c2bThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This patch fixes an issue on Dell R740 hardware as well when booting with BOOTX64 which then switches to fallback firmware:
depending on the bootorder table size, the original code was crashing the system.
Still this patch brings a new issue: duplicated entries.
Indeed, due to the new loop, it's possible that the Linux entry is not currently found in the BootOrder list, which ends up creating a new Linux entry, as shown in the snippet below (verbose mode in fbx64):
Above, we can see the boot entry was found (0006) but not taken into account because it was not in the current
bootordertable (the new code searches for this).Hence a new entry 0005 was created and
bootordermodified accordingly.