nuttx/drivers/serial
raiden00pl a3d4802ff8 drivers/serial: read the consumer index once in uart_recvchars()
Same issue as the previous commit, on the receive side: uart_read()
advances recv.tail from thread context without holding the critical
section, but the recvbuf batch path of uart_recvchars() reads recv.tail
several times (the full check, the watermark count and the free-space
computation).  If uart_read() moves and wraps the index in between, the
computed free space goes negative and is passed to recvbuf() as a huge
size_t, which lets the driver store past the end of the ring buffer.

Read recv.tail once per loop iteration and derive everything from that
snapshot.  The consumer only ever moves the index forward, so a stale
snapshot merely stores less now.

Assisted-by: Claude Code
Signed-off-by: raiden00pl <raiden00@railab.me>
2026-09-10 23:09:16 +08:00
..
CMakeLists.txt serial/xlnx_ps: add common Xilinx UART Peripheral System (XUARTPS) support 2026-02-27 08:14:03 -03:00
Kconfig drivers/serial: correct the USART9 console label 2026-08-27 01:01:51 +08:00
Kconfig-16550 drivers/serial/16550: add polling mode support for serial drivers 2026-02-27 08:14:03 -03:00
Kconfig-cmsdk drivers/serial:support arm cmsdk drivers 2024-04-26 18:42:35 -03:00
Kconfig-lpuart Add initial support for NXP S32K3 MCU family 2022-07-25 23:47:05 +08:00
Kconfig-pci serial/pci: support wildcard UART selection 2026-08-22 02:06:20 +08:00
Kconfig-pl011 drivers/serial/uart_pl011.c : add the interface about clock and reset control for reducing power consumption. 2024-06-03 21:18:44 +08:00
Kconfig-sci
Kconfig-uart
Kconfig-usart drivers/serial/serial: prevent race conditions on 8-bit architectures 2025-06-19 10:01:24 -03:00
Kconfig-xlnxps drivers/serial/xlnxps: add polling mode support for serial drivers 2026-02-27 08:14:03 -03:00
Make.defs serial/xlnx_ps: add common Xilinx UART Peripheral System (XUARTPS) support 2026-02-27 08:14:03 -03:00
ptmx.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
pty.c nuttx: use unified interface in <nuttx/atomic.h> 2026-08-24 13:20:45 +08:00
pty.h drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
serial.c drivers/serial: fetch uart_writev data from the iovec segment 2026-08-09 03:23:28 +08:00
serial_cmsdk.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
serial_dma.c style: fix checkpatch issues after debug.h move 2026-04-07 07:50:06 -03:00
serial_gdbstub.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
serial_io.c drivers/serial: read the consumer index once in uart_recvchars() 2026-09-10 23:09:16 +08:00
uart_16550.c arch/mips: Add basic support for MIPS Creator CI20 board 2026-07-15 08:02:55 -03:00
uart_bth4.c drivers/: Multiple Drivers Are Registered With World Writable - Part 2 2026-07-15 15:27:28 +08:00
uart_bth5.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
uart_hostfs.c drivers/: Multiple Drivers Are Registered With World Writable Part 3 2026-07-16 09:49:07 -03:00
uart_pci_16550.c serial/pci: support wildcard UART selection 2026-08-22 02:06:20 +08:00
uart_pl011.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
uart_ram.c drivers/serial/uart_ram: match uart_ops_s receive() prototype 2026-07-09 09:59:27 -04:00
uart_rpmsg.c serial/uart_rpmsg: Remove redundant CONFIG_RPMSG_UART_CONSOLE macro check 2026-03-03 11:55:34 -05:00
uart_rpmsg_raw.c serial/uart_rpmsg: Remove redundant CONFIG_RPMSG_UART_CONSOLE macro check 2026-03-03 11:55:34 -05:00
uart_xlnx_ps.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00