nuttx/drivers/serial
yi chen 6fdc2dde41 drivers/serial: hold xmit.lock around echo in uart_readv()
uart_putxmitchar() manipulates dev->xmit.head/buffer directly with
no internal locking - every other caller (uart_write()) takes
dev->xmit.lock first. uart_readv()'s ECHO handling (both the
backspace/delete erase sequence and the normal character echo)
calls uart_putxmitchar() without taking that lock, so a concurrent
uart_write() and a local echo can race on the same circular buffer
state, corrupting it.

Take dev->xmit.lock around each echo's uart_putxmitchar() calls,
matching what uart_write() already does. uart_readv() holds
dev->recv.lock for its own duration, but no other code path ever
acquires recv.lock while holding xmit.lock, so nesting xmit.lock
inside the existing recv.lock scope here doesn't introduce a new
lock-ordering cycle.

Fixes #14845

Signed-off-by: yi chen <94xhn1@gmail.com>
2026-07-11 15:00:40 -03:00
..
CMakeLists.txt serial/xlnx_ps: add common Xilinx UART Peripheral System (XUARTPS) support 2026-02-27 08:14:03 -03:00
Kconfig serial/xlnx_ps: add help chapter for XUARTPS 2026-02-27 08:14:03 -03: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 drivers/serial: simplify 16550_PCI_UARTx_CLOCK config 2025-01-03 08:52:43 +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 We have ported NuttX on Renesas RX65N Micro-controller. This port includes following interfaces 2019-10-11 23:36:57 +08:00
Kconfig-uart drivers/serial/Kconfig: Split serial Rx/Tx DMA. 2019-12-03 07:06:30 -06:00
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/serial: fix the issue of the refs count for filep being zeroed out by utilizing dup2 2025-06-26 09:31:14 -03:00
pty.c drivers/serial: add job-control TTY ioctls and libc wrappers 2026-06-23 16:26:53 -03:00
pty.h drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
serial.c drivers/serial: hold xmit.lock around echo in uart_readv() 2026-07-11 15:00:40 -03: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 include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
uart_16550.c drivers/serial/16550: fix AM62x console bring-up 2026-05-28 22:21:38 +08:00
uart_bth4.c drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +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 include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
uart_pci_16550.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03: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