Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
From ada7ff69bd8a95614aa63dd618764daf428f235d Mon Sep 17 00:00:00 2001
From: Gary Lin <glin@suse.com>
Date: Fri, 4 Jun 2021 17:02:31 +0800
Subject: [PATCH 22/26] 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>
---
load-options.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/load-options.c b/load-options.c
index 480832c..e34aa38 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:
--
2.32.0