From: sashiko-bot@kernel.org
To: "Fil Dunsky" <filipp.dunsky@gmail.com>
Cc: linux-serial@vger.kernel.org, robh@kernel.org,
devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH RFC v3 07/10] tty: serial: Add Cortina UART driver
Date: Mon, 12 Oct 2026 07:10:36 +0000 [thread overview]
Message-ID: <sashiko-outbox-167778@kernel.org> (raw)
In-Reply-To: <20261012-b4-cs75xx-v3-7-0e0d17a098cf@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] tty: serial: cortina: corrupted RX data passed as TTY_NORMAL on parity/framing errors
- [Low] serial: incorrect ordering of overrun error reporting in TTY buffer
--
commit 3e704212d6dee31d61d2da0a1c4e2caaf3d70e2e
Author: Fil Dunsky <filipp.dunsky@gmail.com>
tty: serial: Add Cortina UART driver
This commit adds a driver for the UART found in Cortina Systems CS75xx
(Goldengate G2) SoCs. It implements the current serial core API and devm
resource management, and supports the system console and earlycon.
> diff --git a/drivers/tty/serial/cortina-uart.c b/drivers/tty/serial/cortina-uart.c
> new file mode 100644
> index 0000000000000..0c2733a7c6b1d
> --- /dev/null
> +++ b/drivers/tty/serial/cortina-uart.c
[ ... ]
> +static void cortina_uart_rx_chars(struct uart_port *port, u32 status)
> +{
> + struct tty_port *tport = &port->state->port;
> + unsigned int budget = CORTINA_UART_RX_BUDGET;
> + u32 data;
> +
> + if (status & CORTINA_UART_IRQ_RX_OVERRUN) {
> + port->icount.overrun++;
> + tty_insert_flip_char(tport, 0, TTY_OVERRUN);
> + }
[Severity: Low]
Could this result in the TTY_OVERRUN marker being inserted before the older,
valid characters are extracted from the FIFO?
When a hardware overrun occurs, the RX FIFO is full of older, valid
characters, while the newly arriving characters that did not fit were lost.
By inserting the TTY_OVERRUN marker before the while loop that drains the
FIFO, it appears the driver places the error marker before the older
characters in the TTY stream.
Would this cause the TTY layer to report the data loss in the wrong
chronological position relative to the valid data? The overrun marker should
likely be inserted after the valid characters in the FIFO have been drained.
> + if (status & CORTINA_UART_IRQ_RX_PARITY)
> + port->icount.parity++;
> + if (status & CORTINA_UART_IRQ_RX_STOP)
> + port->icount.frame++;
> +
> + while (budget-- && !(readl(port->membase + CORTINA_UART_INFO) &
> + CORTINA_UART_INFO_RX_EMPTY)) {
> + u8 ch;
> +
> + data = readl(port->membase + CORTINA_UART_RXDAT);
> + if (!(data & CORTINA_UART_RXDAT_VALID))
> + continue;
> +
> + port->icount.rx++;
> + ch = FIELD_GET(CORTINA_UART_RXDAT_DATA, data);
> +
> + if (port->ignore_status_mask & CORTINA_UART_RXDAT_VALID)
> + continue;
> + if (uart_prepare_sysrq_char(port, ch))
> + continue;
> +
> + tty_insert_flip_char(tport, ch, TTY_NORMAL);
> + }
[Severity: Medium]
Is it intentional that received characters are unconditionally flagged as
TTY_NORMAL and pushed to the TTY buffer, even if the interrupt indicated a
parity or framing error?
When the hardware detects a parity or framing error, it increments the
corresponding statistics but then unconditionally inserts all received
characters into the TTY buffer with the TTY_NORMAL flag.
[ ... ]
> +static void cortina_uart_set_termios(struct uart_port *port,
> + struct ktermios *termios,
> + const struct ktermios *old)
> +{
[ ... ]
> + uart_port_lock_irqsave(port, &flags);
> +
> + port->ignore_status_mask = 0;
> + if (!(termios->c_cflag & CREAD))
> + port->ignore_status_mask |= CORTINA_UART_RXDAT_VALID;
> +
> + uart_update_timeout(port, termios->c_cflag, baud);
[Severity: Medium]
Should port->read_status_mask or port->ignore_status_mask be configured here
for parity and framing errors?
By not populating these masks based on termios->c_iflag (e.g., INPCK, IGNPAR,
PARMRK), it appears the driver completely bypasses termios error-handling
policies and silently passes corrupted data to userspace as perfectly valid
characters.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261012-b4-cs75xx-v3-0-0e0d17a098cf@gmail.com?part=7
next prev parent reply other threads:[~2026-10-12 7:10 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-12 6:58 [PATCH RFC v3 00/10] ARM: Add support for Cortina Systems CS75xx and Securifi Almond+ Fil Dunsky via B4 Relay
2026-10-12 6:58 ` Fil Dunsky
2026-10-12 6:58 ` [PATCH RFC v3 01/10] dt-bindings: vendor-prefixes: Add Securifi Fil Dunsky via B4 Relay
2026-10-12 6:58 ` Fil Dunsky
2026-10-12 6:59 ` sashiko-bot
2026-10-12 6:58 ` [PATCH RFC v3 02/10] dt-bindings: arm: Add Cortina Systems CS7542 and Securifi Almond+ Fil Dunsky via B4 Relay
2026-10-12 6:58 ` Fil Dunsky
2026-10-12 7:00 ` sashiko-bot
2026-10-12 6:58 ` [PATCH RFC v3 03/10] dt-bindings: arm: cpus: Add Cortina Systems CS7542 enable method Fil Dunsky via B4 Relay
2026-10-12 6:58 ` Fil Dunsky
2026-10-12 7:01 ` sashiko-bot
2026-10-12 6:58 ` [PATCH RFC v3 04/10] ARM: goldengate: Add support for the CS75xx SoC family Fil Dunsky via B4 Relay
2026-10-12 6:58 ` Fil Dunsky
2026-10-12 7:07 ` sashiko-bot
2026-10-12 6:58 ` [PATCH RFC v3 05/10] ARM: debug: Add Cortina Systems CS75xx UART0 support Fil Dunsky via B4 Relay
2026-10-12 6:58 ` Fil Dunsky
2026-10-12 7:05 ` sashiko-bot
2026-10-12 6:58 ` [PATCH RFC v3 06/10] dt-bindings: serial: Add Cortina Systems CS7542 UART Fil Dunsky via B4 Relay
2026-10-12 6:58 ` Fil Dunsky
2026-10-12 7:00 ` sashiko-bot
2026-10-12 6:58 ` [PATCH RFC v3 07/10] tty: serial: Add Cortina UART driver Fil Dunsky via B4 Relay
2026-10-12 6:58 ` Fil Dunsky
2026-10-12 7:10 ` sashiko-bot [this message]
2026-10-12 7:13 ` Jiri Slaby
2026-10-12 7:24 ` Fil Dunsky
2026-10-12 6:58 ` [PATCH RFC v3 08/10] ARM: dts: cortina: Add CS7542 SoC and Securifi Almond+ board Fil Dunsky via B4 Relay
2026-10-12 6:58 ` Fil Dunsky
2026-10-12 7:04 ` sashiko-bot
2026-10-12 6:58 ` [PATCH RFC v3 09/10] ARM: multi_v7_defconfig: Enable Cortina Systems CS75xx support Fil Dunsky via B4 Relay
2026-10-12 6:58 ` Fil Dunsky
2026-10-12 7:01 ` sashiko-bot
2026-10-12 6:58 ` [PATCH RFC v3 10/10] MAINTAINERS: Add entry for Cortina Systems CS75xx Fil Dunsky via B4 Relay
2026-10-12 6:58 ` Fil Dunsky
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=sashiko-outbox-167778@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=filipp.dunsky@gmail.com \
--cc=linux-serial@vger.kernel.org \
--cc=robh@kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.