linux-stable/arch/x86/mm
Michael Kelley 96b5d11777 x86/ioremap: Fix page aligned size calculation in __ioremap_caller()
commit 4dbd6a3e90 upstream.

Current code re-calculates the size after aligning the starting and
ending physical addresses on a page boundary. But the re-calculation
also embeds the masking of high order bits that exceed the size of
the physical address space (via PHYSICAL_PAGE_MASK). If the masking
removes any high order bits, the size calculation results in a huge
value that is likely to immediately fail.

Fix this by re-calculating the page-aligned size first. Then mask any
high order bits using PHYSICAL_PAGE_MASK.

Fixes: ffa71f33a8 ("x86, ioremap: Fix incorrect physical address handling in PAE mode")
Signed-off-by: Michael Kelley <mikelley@microsoft.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Dave Hansen <dave.hansen@linux.intel.com>
Cc: <stable@kernel.org>
Link: https://lore.kernel.org/r/1668624097-14884-2-git-send-email-mikelley@microsoft.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-12-02 17:41:09 +01:00
..
pat x86: Fix return value of __setup handlers 2022-06-09 10:22:53 +02:00
amdtopology.c
cpu_entry_area.c x86/sev: Make the #VC exception stacks part of the default stacks storage 2021-11-18 19:17:21 +01:00
debug_pagetables.c
dump_pagetables.c
extable.c x86/extable: Fix ex_handler_msr() print condition 2022-08-17 14:23:14 +02:00
fault.c x86/mm/64: Improve stack overflow warnings 2021-11-18 19:16:10 +01:00
highmem_32.c x86/mm/highmem: Use generic kmap atomic implementation 2020-11-06 23:14:55 +01:00
hugetlbpage.c mm: remove unneeded includes of <asm/pgalloc.h> 2020-08-07 11:33:26 -07:00
ident_map.c x86/mm/ident_map: Check for errors from ident_pud_init() 2020-10-28 14:48:30 +01:00
init.c x86/pat: Fix x86_has_pat_wp() 2022-07-21 21:24:44 +02:00
init_32.c mm/memory_hotplug: remove nid parameter from arch_remove_memory() 2021-09-08 11:50:23 -07:00
init_64.c x86/mm: Use proper mask when setting PUD mapping 2022-08-25 11:39:53 +02:00
iomap_32.c io-mapping: Cleanup atomic iomap 2020-11-06 23:14:58 +01:00
ioremap.c x86/ioremap: Fix page aligned size calculation in __ioremap_caller() 2022-12-02 17:41:09 +01:00
kasan_init_64.c memblock: introduce saner 'memblock_free_ptr()' interface 2021-09-14 13:23:22 -07:00
kaslr.c x86: Fix various typos in comments 2021-03-18 15:31:53 +01:00
kmmio.c x86: Fix various typos in comments 2021-03-18 15:31:53 +01:00
maccess.c maccess: rename probe_kernel_{read,write} to copy_{from,to}_kernel_nofault 2020-06-17 10:57:41 -07:00
Makefile kbuild: remove cc-option test of -fno-stack-protector 2020-07-07 11:13:10 +09:00
mem_encrypt.c x86/sev: Add an x86 version of cc_platform_has() 2021-11-18 19:17:21 +01:00
mem_encrypt_boot.S objtool: Update Retpoline validation 2022-07-23 12:54:04 +02:00
mem_encrypt_identity.c x86/sme: Use #define USE_EARLY_PGTABLE_L5 in mem_encrypt_identity.c 2021-11-18 19:15:56 +01:00
mm_internal.h
mmap.c
mmio-mod.c x86/mmiotrace: Replace deprecated CPU-hotplug functions. 2021-08-10 14:46:27 +02:00
numa.c x86/numa: Use cpumask_available instead of hardcoded NULL check 2022-08-17 14:24:15 +02:00
numa_32.c
numa_64.c
numa_emulation.c memblock: introduce saner 'memblock_free_ptr()' interface 2021-09-14 13:23:22 -07:00
numa_internal.h
pf_in.c
pf_in.h
pgtable.c Revert "mm/pgtable: add stubs for {pmd/pub}_{set/clear}_huge" 2021-07-21 11:28:09 +01:00
pgtable_32.c mm: remove unneeded includes of <asm/pgalloc.h> 2020-08-07 11:33:26 -07:00
physaddr.c
physaddr.h
pkeys.c Fixes and improvements for FPU handling on x86: 2021-07-07 11:12:01 -07:00
pti.c x86/process/64: Move cpu_current_top_of_stack out of TSS 2021-03-28 22:40:10 +02:00
setup_nx.c
srat.c
testmmiotrace.c
tlb.c x86/mm/tlb: Revert retpoline avoidance approach 2022-04-13 20:59:23 +02:00