Re: [PATCH v2 4/4] serial: imx: serialize imx_uart_ports[] lifetime

Karl Mehltretter <[email protected]> Fri, 31 Jul 2026 16:59:19 +0200
Newsgroups dev.linux.lists.imx,dev.linux.lists.sashiko-reviews
Message-ID <[email protected]>
On Sun, Jul 19, 2026 at 10:25:00PM +0100, [email protected] wrote:
> [Severity: High]
> If a duplicate UART alias is probed, such as from a misconfigured device
> tree, does this unconditionally overwrite an already active port's entry
> in imx_uart_ports?
> 
> When uart_add_one_port() subsequently fails for the duplicate, this error
> path sets the entry to NULL. The original port remains active, but will
> console callbacks that rely on imx_uart_ports[] encounter a NULL pointer
> dereference and crash the system?
> 

The existing code already overwrites the active slot.
If uart_add_one_port() fails, this leaves the slot pointing to the freed
duplicate port. This patch changes that failure mode to a NULL pointer.
I'll reject an occupied slot in v3.

Thanks,
Karl