Patch "efi/libstub: Fix path separator regression" has been added to the 5.7-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    efi/libstub: Fix path separator regression

to the 5.7-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     efi-libstub-fix-path-separator-regression.patch
and it can be found in the queue-5.7 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 973597b4266c06ad4ccb1c6fe7d407fe5fa65733
Author: Philipp Fent <fent@xxxxxxxxx>
Date:   Mon Jun 15 13:51:09 2020 +0200

    efi/libstub: Fix path separator regression
    
    [ Upstream commit 7a88a6227dc7f2e723bba11ece05e57bd8dce8e4 ]
    
    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@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20200615115109.7823-1-fent@xxxxxxxxx
    [ardb: rewrite as chained if/else statements]
    Signed-off-by: Ard Biesheuvel <ardb@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/firmware/efi/libstub/file.c b/drivers/firmware/efi/libstub/file.c
index ea66b1f16a79d..f1c4faf58c764 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;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux