[PATCH] serial: 8250: account for partial receive DMA delivery to TTY

From: James Hilliard

Date: Wed Oct 21 2026 - 18:09:25 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>
---
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: 1184f87e2790e8af9be3116f608d2e86b4792d7d
change-id: 20261021-submit-serial-8250-dma-rx-accounting-v1-4122c91dedbe

Best regards,
--
James Hilliard <james.hilliard1@xxxxxxxxx>