Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37620169
en ru br
ALT Linux repos
S:15.7-alt3

Group :: System/Kernel and hardware
RPM: shim

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

Patch: shim-15.4-upstream-0022-shim-don-t-fail-on-the-odd-LoadOptions-length.patch
Download


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/35] 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 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:
-- 
2.32.0
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin