From: sashiko-bot@kernel.org
To: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Cc: linux-serial@vger.kernel.org
Subject: Re: [PATCH v2 5/6] serial: 8250_omap: set priv->line before enabling the IRQ
Date: Wed, 14 Oct 2026 06:49:22 +0000 [thread overview]
Message-ID: <sashiko-outbox-170894@kernel.org> (raw)
In-Reply-To: <3b3a642f7df2285f49a7bbbe5d1c23fa442c7d94.1791873876.git.jirislaby@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] serial: 8250_omap: data race on priv->line assignment
--
commit 5147cae847c38d599a30c92bc983c41140a1abad
Author: Jiri Slaby (SUSE) <jirislaby@kernel.org>
serial: 8250_omap: set priv->line before enabling the IRQ
This commit fixes an issue where the IRQ handler could dereference an unset
priv->line if an interrupt occurs before omap8250_probe() stores it. It
stores port->line into priv->line in omap_8250_startup() before enabling
the IRQ to ensure the handler always sees a valid line number.
Cc: stable@vger.kernel.org
> diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
> index 3a1473bf54d0f..137175aa4183a 100644
> --- a/drivers/tty/serial/8250/8250_omap.c
> +++ b/drivers/tty/serial/8250/8250_omap.c
> @@ -711,6 +711,9 @@ static int omap_8250_startup(struct uart_port *port)
> struct uart_8250_dma *dma = &priv->omap8250_dma;
> int ret;
>
> + /* ISR and runtime PM need the line; probe sets it only after registration */
> + priv->line = port->line;
> +
[Severity: Low]
Does this new assignment introduce a data race regression on the unannotated
priv->line variable?
In omap8250_probe(), serial8250_register_8250_port() is called, which
exposes the TTY device to userspace. A concurrent userspace open() can then
immediately trigger omap_8250_startup() on another CPU, which executes this
new assignment:
priv->line = port->line;
Meanwhile, the original omap8250_probe() execution resumes and writes to the
same variable:
priv->line = ret;
This can result in a write-write data race between omap_8250_startup() and
omap8250_probe(). Furthermore, since omap_8250_startup() also enables the IRQ,
omap8250_irq() can fire and perform an unannotated read:
struct uart_8250_port *up = serial8250_get_port(priv->line);
While functionally benign since both paths write the same aligned value, this
creates unannotated read-write and write-write races that constitute
undefined behavior under C11/LKMM and will trigger KCSAN warnings.
Could WRITE_ONCE() and READ_ONCE() be used to safely handle these concurrent
accesses?
> #ifdef CONFIG_PM
> up->capabilities |= UART_CAP_RPM;
> #endif
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1791873876.git.jirislaby@kernel.org?part=5
next prev parent reply other threads:[~2026-10-14 6:49 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-13 6:48 [PATCH v2 0/6] serial: 8250: make port operations work on struct uart_8250_port Jiri Slaby (SUSE)
2026-10-13 6:48 ` [PATCH v2 1/6] serial: 8250: drop err label from serial8250_register_8250_port() Jiri Slaby (SUSE)
2026-10-14 6:49 ` sashiko-bot
2026-10-13 6:48 ` [PATCH v2 2/6] serial: 8250_exar: remove useless void * casts Jiri Slaby (SUSE)
2026-10-14 6:49 ` sashiko-bot
2026-10-13 6:48 ` [PATCH v2 3/6] serial: 8250_exar: store the GPIO platform device in struct exar8250 Jiri Slaby (SUSE)
2026-10-14 6:49 ` sashiko-bot
2026-10-13 6:48 ` [PATCH v2 4/6] serial: 8250_lpss: do not touch uninitialized line in ehl_serial_exit() Jiri Slaby (SUSE)
2026-10-13 21:13 ` Andy Shevchenko
2026-10-14 6:49 ` sashiko-bot
2026-10-13 6:48 ` [PATCH v2 5/6] serial: 8250_omap: set priv->line before enabling the IRQ Jiri Slaby (SUSE)
2026-10-14 6:49 ` sashiko-bot [this message]
2026-10-13 6:48 ` [PATCH v2 6/6] serial: 8250: make port operations work on struct uart_8250_port Jiri Slaby (SUSE)
2026-10-13 7:33 ` Andy Shevchenko
2026-10-13 7:53 ` Jiri Slaby
2026-10-13 9:09 ` Andy Shevchenko
2026-10-13 9:39 ` Jiri Slaby
2026-10-13 10:00 ` Andy Shevchenko
2026-10-13 10:15 ` Jiri Slaby
2026-10-13 10:54 ` Alejandro Colomar
2026-10-13 10:51 ` Alejandro Colomar
2026-10-13 11:06 ` Jiri Slaby
2026-10-13 13:42 ` Andy Shevchenko
2026-10-14 6:49 ` 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=sashiko-outbox-170894@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=jirislaby@kernel.org \
--cc=linux-serial@vger.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.