From: James Hilliard <james.hilliard1@gmail.com>
To: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Jiri Slaby" <jirislaby@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Chuah, Kim Tatt" <kim.tatt.chuah@intel.com>,
"Vinod Koul" <vkoul@kernel.org>,
"Andy Shevchenko" <andy@kernel.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Heikki Krogerus <heikki.krogerus@linux.intel.com>,
Raul E Rangel <rrangel@chromium.org>,
linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org,
James Hilliard <james.hilliard1@gmail.com>
Subject: [PATCH v2] serial: 8250_mid: lock RX DMA timeout flushing
Date: Fri, 04 Dec 2026 02:59:53 -0700 [thread overview]
Message-ID: <20261204-submit-serial-8250-mid-rx-lock-v1-v2-1-7c773895f58d@gmail.com> (raw)
The Tangier and Denverton DMA timeout handlers call
serial8250_rx_dma_flush() without holding the UART port lock. The helper
pauses the transfer, copies received data, updates RX state and terminates
the channel. The DMA completion callback accesses the same state under the
port lock, so it can race an unlocked timeout flush. The IRQ-chain lock
held by serial8250_interrupt() does not serialize the completion callback.
Take the port lock around each timeout flush. Release it before handling
the UART interrupt, since serial8250_handle_irq() acquires the port lock
itself.
Fixes: 692aa1905679 ("serial: 8250_mid: Read RX buffer on RX DMA timeout for DNV")
Fixes: 4831e0d9054c ("serial: 8250_mid: handle interrupt correctly in DMA case")
Cc: stable@vger.kernel.org
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
Previously included in the DMA cancellation series v4:
https://lore.kernel.org/r/20261023-submit-serial-8250-dma-cancel-v1-v4-0-e759de1839de@gmail.com
---
Changes in v2:
- Rebase on current tty-next for resubmission.
- Link to v1: https://patch.msgid.link/20261024-submit-serial-8250-mid-rx-lock-v1-v1-1-2b9afdf869d7@gmail.com
---
drivers/tty/serial/8250/8250_mid.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/8250/8250_mid.c b/drivers/tty/serial/8250/8250_mid.c
index df721418e97e..81a1081abfdd 100644
--- a/drivers/tty/serial/8250/8250_mid.c
+++ b/drivers/tty/serial/8250/8250_mid.c
@@ -94,7 +94,8 @@ static int tng_handle_irq(struct uart_port *p)
/* Rx DMA */
err = hsu_dma_get_status(chip, mid->dma_index * 2 + 1, &status);
if (err > 0) {
- serial8250_rx_dma_flush(up);
+ scoped_guard(uart_port_lock_irqsave, p)
+ serial8250_rx_dma_flush(up);
ret |= 1;
} else if (err == 0)
ret |= hsu_dma_do_irq(chip, mid->dma_index * 2 + 1, status);
@@ -148,7 +149,8 @@ static int dnv_handle_irq(struct uart_port *p)
if (fisr & BIT(2)) {
err = hsu_dma_get_status(&mid->dma_chip, 1, &status);
if (err > 0) {
- serial8250_rx_dma_flush(up);
+ scoped_guard(uart_port_lock_irqsave, p)
+ serial8250_rx_dma_flush(up);
ret |= 1;
} else if (err == 0)
ret |= hsu_dma_do_irq(&mid->dma_chip, 1, status);
---
base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244
base-tree: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-next
change-id: 20261024-submit-serial-8250-mid-rx-lock-v1-21c66e80df80
Best regards,
--
James Hilliard <james.hilliard1@gmail.com>
next reply other threads:[~2026-12-04 10:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 9:59 James Hilliard [this message]
2026-12-04 10:07 ` Greg Kroah-Hartman
2026-12-04 20:12 ` James Hilliard
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=20261204-submit-serial-8250-mid-rx-lock-v1-v2-1-7c773895f58d@gmail.com \
--to=james.hilliard1@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=andy@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jirislaby@kernel.org \
--cc=kim.tatt.chuah@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=rrangel@chromium.org \
--cc=stable@vger.kernel.org \
--cc=vkoul@kernel.org \
/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
all inboxes | Powered by JetHome®