Skip to content

Commit d130041

Browse files
tobluxbp3tk0v
authored andcommitted
x86/boot: Reject too long acpi_rsdp= values
cmdline_find_option() returns the full length of the parsed acpi_rsdp= value. get_cmdline_acpi_rsdp() then silently truncates values which do not fit in the val[] buffer. Prevent boot_kstrtoul() from parsing a truncated value and then the kernel from silently using the wrong RSDP address, see discussion in Link:. Issue a warning so that the user is aware that s/he supplied a malformed value and can get feedback instead of silent crashes. [ bp: Make commit message more precise. ] Fixes: 3c98e71 ("x86/boot: Add "acpi_rsdp=" early parsing") Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/all/20260617130417.36651-4-thorsten.blum@linux.dev
1 parent 1ecb29b commit d130041

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

  • arch/x86/boot/compressed

arch/x86/boot/compressed/acpi.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,15 @@ static unsigned long get_cmdline_acpi_rsdp(void)
184184
char val[MAX_ADDR_LEN] = { };
185185
int ret;
186186

187-
ret = cmdline_find_option("acpi_rsdp", val, MAX_ADDR_LEN);
187+
ret = cmdline_find_option("acpi_rsdp", val, sizeof(val));
188188
if (ret < 0)
189189
return 0;
190190

191+
if (ret >= sizeof(val)) {
192+
warn("acpi_rsdp= value too long; ignoring");
193+
return 0;
194+
}
195+
191196
if (boot_kstrtoul(val, 16, &addr))
192197
return 0;
193198
#endif

0 commit comments

Comments
 (0)