summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Lin <glin@suse.com>2021-06-04 17:02:31 +0800
committerPeter Jones <pjones@redhat.com>2021-07-20 09:44:47 -0400
commitada7ff69bd8a95614aa63dd618764daf428f235d (patch)
tree3a37d99f58c5d6999165609789119d2e9be7ed15
parent3ea1f37c70c571537c92e2be0d78a1ad4629af8f (diff)
downloadefi-boot-shim-ada7ff69bd8a95614aa63dd618764daf428f235d.tar.gz
efi-boot-shim-ada7ff69bd8a95614aa63dd618764daf428f235d.zip
shim: don't fail on the odd LoadOptions length
Some firmware feeds the LoadOptions with an odd length when booting from an USB device(*). We should only skip this kind of LoadOptions, not fail it, or the user won't be able to boot the system from USB or CD-ROM. (*) https://bugzilla.suse.com/show_bug.cgi?id=1185232#c62 Signed-off-by: Gary Lin <glin@suse.com>
-rw-r--r--load-options.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/load-options.c b/load-options.c
index 480832c1..e34aa381 100644
--- a/load-options.c
+++ b/load-options.c
@@ -310,9 +310,17 @@ parse_load_options(EFI_LOADED_IMAGE *li)
UINT32 remaining_size;
CHAR16 *loader_str = NULL;
- /* Sanity check since we make several assumptions about the length */
+ /*
+ * Sanity check since we make several assumptions about the length
+ * Some firmware feeds the following load option when booting from
+ * an USB device:
+ *
+ * 0x46 0x4a 0x00 |FJ.|
+ *
+ * The string is meaningless for shim and so just ignore it.
+ */
if (li->LoadOptionsSize % 2 != 0)
- return EFI_INVALID_PARAMETER;
+ return EFI_SUCCESS;
/* So, load options are a giant pain in the ass. If we're invoked
* from the EFI shell, we get something like this: