]> www.infradead.org Git - users/jedix/linux-maple.git/commit
x86/sev: Fix calculation of end address based on number of pages
authorTom Lendacky <thomas.lendacky@amd.com>
Tue, 6 Jun 2023 14:51:22 +0000 (09:51 -0500)
committerBorislav Petkov (AMD) <bp@alien8.de>
Tue, 6 Jun 2023 16:27:20 +0000 (18:27 +0200)
commit5dee19b6b2b194216919b99a1f5af2949a754016
tree4ba6398a17bbb75c58d65660abb361ae063f6220
parent75d090fd167acab4d7eda7e2b65729e877c0fd64
x86/sev: Fix calculation of end address based on number of pages

When calculating an end address based on an unsigned int number of pages,
any value greater than or equal to 0x100000 that is shift PAGE_SHIFT bits
results in a 0 value, resulting in an invalid end address. Change the
number of pages variable in various routines from an unsigned int to an
unsigned long to calculate the end address correctly.

Fixes: 5e5ccff60a29 ("x86/sev: Add helper for validating pages in early enc attribute changes")
Fixes: dc3f3d2474b8 ("x86/mm: Validate memory when changing the C-bit")
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/6a6e4eea0e1414402bac747744984fa4e9c01bb6.1686063086.git.thomas.lendacky@amd.com
arch/x86/include/asm/sev.h
arch/x86/kernel/sev.c