From: Greg Kroah-Hartman Date: Tue, 4 Jun 2019 13:46:59 +0000 (+0200) Subject: drop efi-x86-add-missing-error-handling-to-old_memmap-1-1-mapping-code.patch X-Git-Tag: v5.1.8~27 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f9adcb7baef66d36cabcbaf2e95adb68f7b1f712;p=thirdparty%2Fkernel%2Fstable-queue.git drop efi-x86-add-missing-error-handling-to-old_memmap-1-1-mapping-code.patch --- diff --git a/queue-4.19/efi-x86-add-missing-error-handling-to-old_memmap-1-1-mapping-code.patch b/queue-4.19/efi-x86-add-missing-error-handling-to-old_memmap-1-1-mapping-code.patch deleted file mode 100644 index ab482fad0ca..00000000000 --- a/queue-4.19/efi-x86-add-missing-error-handling-to-old_memmap-1-1-mapping-code.patch +++ /dev/null @@ -1,86 +0,0 @@ -From 4e78921ba4dd0aca1cc89168f45039add4183f8e Mon Sep 17 00:00:00 2001 -From: Gen Zhang -Date: Sat, 25 May 2019 13:25:58 +0200 -Subject: efi/x86/Add missing error handling to old_memmap 1:1 mapping code - -From: Gen Zhang - -commit 4e78921ba4dd0aca1cc89168f45039add4183f8e upstream. - -The old_memmap flow in efi_call_phys_prolog() performs numerous memory -allocations, and either does not check for failure at all, or it does -but fails to propagate it back to the caller, which may end up calling -into the firmware with an incomplete 1:1 mapping. - -So let's fix this by returning NULL from efi_call_phys_prolog() on -memory allocation failures only, and by handling this condition in the -caller. Also, clean up any half baked sets of page tables that we may -have created before returning with a NULL return value. - -Note that any failure at this level will trigger a panic() two levels -up, so none of this makes a huge difference, but it is a nice cleanup -nonetheless. - -[ardb: update commit log, add efi_call_phys_epilog() call on error path] - -Signed-off-by: Gen Zhang -Signed-off-by: Ard Biesheuvel -Cc: Linus Torvalds -Cc: Peter Zijlstra -Cc: Rob Bradford -Cc: Thomas Gleixner -Cc: linux-efi@vger.kernel.org -Link: http://lkml.kernel.org/r/20190525112559.7917-2-ard.biesheuvel@linaro.org -Signed-off-by: Ingo Molnar -Cc: Zubin Mithra -Signed-off-by: Greg Kroah-Hartman - ---- - arch/x86/platform/efi/efi.c | 2 ++ - arch/x86/platform/efi/efi_64.c | 9 ++++++--- - 2 files changed, 8 insertions(+), 3 deletions(-) - ---- a/arch/x86/platform/efi/efi.c -+++ b/arch/x86/platform/efi/efi.c -@@ -86,6 +86,8 @@ static efi_status_t __init phys_efi_set_ - pgd_t *save_pgd; - - save_pgd = efi_call_phys_prolog(); -+ if (!save_pgd) -+ return EFI_ABORTED; - - /* Disable interrupts around EFI calls: */ - local_irq_save(flags); ---- a/arch/x86/platform/efi/efi_64.c -+++ b/arch/x86/platform/efi/efi_64.c -@@ -84,13 +84,15 @@ pgd_t * __init efi_call_phys_prolog(void - - if (!efi_enabled(EFI_OLD_MEMMAP)) { - efi_switch_mm(&efi_mm); -- return NULL; -+ return efi_mm.pgd; - } - - early_code_mapping_set_exec(1); - - n_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT), PGDIR_SIZE); - save_pgd = kmalloc_array(n_pgds, sizeof(*save_pgd), GFP_KERNEL); -+ if (!save_pgd) -+ return NULL; - - /* - * Build 1:1 identity mapping for efi=old_map usage. Note that -@@ -138,10 +140,11 @@ pgd_t * __init efi_call_phys_prolog(void - pgd_offset_k(pgd * PGDIR_SIZE)->pgd &= ~_PAGE_NX; - } - --out: - __flush_tlb_all(); -- - return save_pgd; -+out: -+ efi_call_phys_epilog(save_pgd); -+ return NULL; - } - - void __init efi_call_phys_epilog(pgd_t *save_pgd) diff --git a/queue-4.19/series b/queue-4.19/series index 1313b288050..9c836fd7234 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -53,7 +53,6 @@ cifs-fix-memory-leak-of-pneg_inbuf-on-eopnotsupp-ioctl-case.patch cifs-cifs_read_allocate_pages-don-t-iterate-through-whole-page-array-on-enomem.patch revert-lockd-show-pid-of-lockd-for-remote-locks.patch gcc-plugins-fix-build-failures-under-darwin-host.patch -efi-x86-add-missing-error-handling-to-old_memmap-1-1-mapping-code.patch drm-tegra-gem-fix-cpu-cache-maintenance-for-bo-s-allocated-using-get_pages.patch drm-vmwgfx-don-t-send-drm-sysfs-hotplug-events-on-initial-master-set.patch drm-sun4i-fix-sun8i-hdmi-phy-clock-initialization.patch diff --git a/queue-5.1/efi-x86-add-missing-error-handling-to-old_memmap-1-1-mapping-code.patch b/queue-5.1/efi-x86-add-missing-error-handling-to-old_memmap-1-1-mapping-code.patch deleted file mode 100644 index 9d923f5f1db..00000000000 --- a/queue-5.1/efi-x86-add-missing-error-handling-to-old_memmap-1-1-mapping-code.patch +++ /dev/null @@ -1,86 +0,0 @@ -From 4e78921ba4dd0aca1cc89168f45039add4183f8e Mon Sep 17 00:00:00 2001 -From: Gen Zhang -Date: Sat, 25 May 2019 13:25:58 +0200 -Subject: efi/x86/Add missing error handling to old_memmap 1:1 mapping code - -From: Gen Zhang - -commit 4e78921ba4dd0aca1cc89168f45039add4183f8e upstream. - -The old_memmap flow in efi_call_phys_prolog() performs numerous memory -allocations, and either does not check for failure at all, or it does -but fails to propagate it back to the caller, which may end up calling -into the firmware with an incomplete 1:1 mapping. - -So let's fix this by returning NULL from efi_call_phys_prolog() on -memory allocation failures only, and by handling this condition in the -caller. Also, clean up any half baked sets of page tables that we may -have created before returning with a NULL return value. - -Note that any failure at this level will trigger a panic() two levels -up, so none of this makes a huge difference, but it is a nice cleanup -nonetheless. - -[ardb: update commit log, add efi_call_phys_epilog() call on error path] - -Signed-off-by: Gen Zhang -Signed-off-by: Ard Biesheuvel -Cc: Linus Torvalds -Cc: Peter Zijlstra -Cc: Rob Bradford -Cc: Thomas Gleixner -Cc: linux-efi@vger.kernel.org -Link: http://lkml.kernel.org/r/20190525112559.7917-2-ard.biesheuvel@linaro.org -Signed-off-by: Ingo Molnar -Cc: Zubin Mithra -Signed-off-by: Greg Kroah-Hartman - ---- - arch/x86/platform/efi/efi.c | 2 ++ - arch/x86/platform/efi/efi_64.c | 9 ++++++--- - 2 files changed, 8 insertions(+), 3 deletions(-) - ---- a/arch/x86/platform/efi/efi.c -+++ b/arch/x86/platform/efi/efi.c -@@ -85,6 +85,8 @@ static efi_status_t __init phys_efi_set_ - pgd_t *save_pgd; - - save_pgd = efi_call_phys_prolog(); -+ if (!save_pgd) -+ return EFI_ABORTED; - - /* Disable interrupts around EFI calls: */ - local_irq_save(flags); ---- a/arch/x86/platform/efi/efi_64.c -+++ b/arch/x86/platform/efi/efi_64.c -@@ -84,13 +84,15 @@ pgd_t * __init efi_call_phys_prolog(void - - if (!efi_enabled(EFI_OLD_MEMMAP)) { - efi_switch_mm(&efi_mm); -- return NULL; -+ return efi_mm.pgd; - } - - early_code_mapping_set_exec(1); - - n_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT), PGDIR_SIZE); - save_pgd = kmalloc_array(n_pgds, sizeof(*save_pgd), GFP_KERNEL); -+ if (!save_pgd) -+ return NULL; - - /* - * Build 1:1 identity mapping for efi=old_map usage. Note that -@@ -138,10 +140,11 @@ pgd_t * __init efi_call_phys_prolog(void - pgd_offset_k(pgd * PGDIR_SIZE)->pgd &= ~_PAGE_NX; - } - --out: - __flush_tlb_all(); -- - return save_pgd; -+out: -+ efi_call_phys_epilog(save_pgd); -+ return NULL; - } - - void __init efi_call_phys_epilog(pgd_t *save_pgd) diff --git a/queue-5.1/series b/queue-5.1/series index 9e7079be5f9..7be2fc83c04 100644 --- a/queue-5.1/series +++ b/queue-5.1/series @@ -68,7 +68,6 @@ cifs-fix-memory-leak-of-pneg_inbuf-on-eopnotsupp-ioctl-case.patch cifs-cifs_read_allocate_pages-don-t-iterate-through-whole-page-array-on-enomem.patch revert-lockd-show-pid-of-lockd-for-remote-locks.patch gcc-plugins-fix-build-failures-under-darwin-host.patch -efi-x86-add-missing-error-handling-to-old_memmap-1-1-mapping-code.patch drm-tegra-gem-fix-cpu-cache-maintenance-for-bo-s-allocated-using-get_pages.patch drm-vmwgfx-fix-user-space-handle-equal-to-zero.patch drm-vmwgfx-fix-compat-mode-shader-operation.patch