From: sashiko-bot@kernel.org
To: "Markus Probst" <markus.probst@posteo.de>
Cc: linux-serial@vger.kernel.org
Subject: Re: [PATCH RESEND v4] ACPI: SPCR: Support UART clock frequency field
Date: Wed, 30 Sep 2026 15:45:17 +0000 [thread overview]
Message-ID: <20260930154517.97E6B1F00898@smtp.kernel.org> (raw)
In-Reply-To: <20260930-acpi_spcr-v4-1-ab649aa1f09c@posteo.de>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] acpi: out-of-bounds read of SPCR uart_clk_freq field
--
commit 541ea063ef44d64e511d2deae13a8adcab45ebc7
Author: Markus Probst <markus.probst@posteo.de>
ACPI: SPCR: Support UART clock frequency field
This commit adds support for the UART Clock Frequency field introduced in the
Microsoft SPCR specification revision 1.08. It introduces a new function
setup_earlycon_with_uartclk() to configure the serial port with the correct
clock frequency from the SPCR table if available.
Link: https://learn.microsoft.com/en-us/windows-hardware/drivers/serports/serial-port-console-redirection-table
> diff --git a/drivers/acpi/spcr.c b/drivers/acpi/spcr.c
> index 73cb933fdc89b..c79c809f49d46 100644
> --- a/drivers/acpi/spcr.c
> +++ b/drivers/acpi/spcr.c
> @@ -228,7 +228,8 @@ int __init acpi_parse_spcr(bool enable_earlycon, bool enable_console)
> pr_info("console: %s\n", opts);
>
> if (enable_earlycon)
> - setup_earlycon(opts);
> + setup_earlycon_with_uartclk(opts,
> + table->header.revision >= 3 ? table->uart_clk_freq : 0);
[Severity: Medium]
Does this code risk an out-of-bounds memory read when accessing
table->uart_clk_freq?
In acpi_parse_spcr(), the table is mapped using acpi_get_table(), which
only maps the number of bytes specified by table->header.length.
If a malformed ACPI SPCR table is provided by system firmware where
table->header.revision >= 3 but the length is too small to contain
uart_clk_freq, could this access read past the mapped length?
This could result in unmapped memory accesses leading to an early boot kernel
panic, or silently reading garbage data which results in an incorrect early
console UART clock frequency.
Should there be a validation of table->header.length against the expected
size containing the uart_clk_freq field before accessing it?
>
> if (enable_console)
> err = add_preferred_console(uart, 0, opts + strlen(uart) + 1);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260930-acpi_spcr-v4-1-ab649aa1f09c@posteo.de?part=1
next prev parent reply other threads:[~2026-09-30 15:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-30 15:33 [PATCH RESEND v4] ACPI: SPCR: Support UART clock frequency field Markus Probst
2026-09-30 15:45 ` sashiko-bot [this message]
2026-09-30 17:35 ` Markus Probst
-- strict thread matches above, loose matches on Subject: below --
2026-09-13 16:17 Markus Probst
2026-09-13 16:23 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260930154517.97E6B1F00898@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=markus.probst@posteo.de \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox