[PATCH v2] serial: 8250: account for partial receive DMA delivery to TTY
From: James Hilliard
Date: Fri Dec 04 2026 - 04:54:48 EST
tty_insert_flip_string() can accept fewer bytes than requested when the
flip buffer cannot grow. The DMA receive path advances past the entire
range regardless, but does not record that some bytes were dropped.
Increment buf_overrun on a short insertion, as the PIO receive path
does for a failed character insertion. Keep rx accounting for bytes
received from hardware and do not retry data after the DMA buffer has
been released.
Fixes: 9ee4b83e51f7 ("serial: 8250: Add support for dmaengine")
Signed-off-by: James Hilliard <james.hilliard1@xxxxxxxxx>
---
Changes in v2:
- Rebase on current tty-next for resubmission.
- Link to v1: https://patch.msgid.link/20261021-submit-serial-8250-dma-rx-accounting-v1-v1-1-c11795914ab4@xxxxxxxxx
---
drivers/tty/serial/8250/8250_dma.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/tty/serial/8250/8250_dma.c b/drivers/tty/serial/8250/8250_dma.c
index 1da605cc8601..46fe4ebbf451 100644
--- a/drivers/tty/serial/8250/8250_dma.c
+++ b/drivers/tty/serial/8250/8250_dma.c
@@ -57,7 +57,8 @@ static void __dma_rx_complete(struct uart_8250_port *p)
count = dma->rx_size - state.residue;
- tty_insert_flip_string(tty_port, dma->rx_buf, count);
+ if (tty_insert_flip_string(tty_port, dma->rx_buf, count) != count)
+ p->port.icount.buf_overrun++;
p->port.icount.rx += count;
dma->rx_running = 0;
---
base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244
base-tree: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-next
change-id: 20261021-submit-serial-8250-dma-rx-accounting-v1-4122c91dedbe
Best regards,
--
James Hilliard <james.hilliard1@xxxxxxxxx>