summarylogtreecommitdiffstats
path: root/0002-efi-libstub-Fix-path-separator-regression.patch
diff options
context:
space:
mode:
authorgraysky2020-06-25 07:15:49 -0400
committergraysky2020-06-25 07:15:49 -0400
commita664c11c71b2988bd9487847503585c1642f21da (patch)
treeb34ace003a7c082b73a8405bea32c1bad8b35b14 /0002-efi-libstub-Fix-path-separator-regression.patch
parentc3f61dc7460bb3b7cfa857c9ea0ceabd31b44317 (diff)
downloadaur-a664c11c71b2988bd9487847503585c1642f21da.tar.gz
Update to 5.7.6-2
Diffstat (limited to '0002-efi-libstub-Fix-path-separator-regression.patch')
-rw-r--r--0002-efi-libstub-Fix-path-separator-regression.patch54
1 files changed, 54 insertions, 0 deletions
diff --git a/0002-efi-libstub-Fix-path-separator-regression.patch b/0002-efi-libstub-Fix-path-separator-regression.patch
new file mode 100644
index 000000000000..fc504dbc4448
--- /dev/null
+++ b/0002-efi-libstub-Fix-path-separator-regression.patch
@@ -0,0 +1,54 @@
+From 2eff8033714ddf05bb2fe52003921af8c8839ed2 Mon Sep 17 00:00:00 2001
+From: Philipp Fent <fent@in.tum.de>
+Date: Mon, 15 Jun 2020 13:51:09 +0200
+Subject: [PATCH 2/3] efi/libstub: Fix path separator regression
+
+Commit 9302c1bb8e47 ("efi/libstub: Rewrite file I/O routine") introduced a
+regression that made a couple of (badly configured) systems fail to
+boot [1]: Until 5.6, we silently accepted Unix-style file separators in
+EFI paths, which might violate the EFI standard, but are an easy to make
+mistake. This fix restores the pre-5.7 behaviour.
+
+[1] https://bbs.archlinux.org/viewtopic.php?id=256273
+
+Fixes: 9302c1bb8e47 ("efi/libstub: Rewrite file I/O routine")
+Signed-off-by: Philipp Fent <fent@in.tum.de>
+Link: https://lore.kernel.org/r/20200615115109.7823-1-fent@in.tum.de
+[ardb: rewrite as chained if/else statements]
+Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
+---
+ drivers/firmware/efi/libstub/file.c | 16 ++++++++++++----
+ 1 file changed, 12 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/firmware/efi/libstub/file.c b/drivers/firmware/efi/libstub/file.c
+index ea66b1f16a79..f1c4faf58c76 100644
+--- a/drivers/firmware/efi/libstub/file.c
++++ b/drivers/firmware/efi/libstub/file.c
+@@ -104,12 +104,20 @@ static int find_file_option(const efi_char16_t *cmdline, int cmdline_len,
+ if (!found)
+ return 0;
+
++ /* Skip any leading slashes */
++ while (cmdline[i] == L'/' || cmdline[i] == L'\\')
++ i++;
++
+ while (--result_len > 0 && i < cmdline_len) {
+- if (cmdline[i] == L'\0' ||
+- cmdline[i] == L'\n' ||
+- cmdline[i] == L' ')
++ efi_char16_t c = cmdline[i++];
++
++ if (c == L'\0' || c == L'\n' || c == L' ')
+ break;
+- *result++ = cmdline[i++];
++ else if (c == L'/')
++ /* Replace UNIX dir separators with EFI standard ones */
++ *result++ = L'\\';
++ else
++ *result++ = c;
+ }
+ *result = L'\0';
+ return i;
+--
+2.27.0
+