Re: [PATCH v2 1/2] serial: amba-pl011: unprepare console clock on unregister

From: Karl Mehltretter

Date: Fri Jul 24 2026 - 18:23:22 EST


On Fri, Jul 24, 2026 at 09:55:47PM +0100, sashiko-bot@xxxxxxxxxx wrote:
> [Severity: High]
> Is it possible for uap to be NULL here in pl011_console_exit() within
> drivers/tty/serial/amba-pl011.c?
>

The root cause is in serial core: serial_core_add_one_port() registers the
console (uart_configure_port()) before the fallible tty_groups allocation,
so a failure there leaves the console registered after the driver has
cleared amba_ports[]. A NULL check in exit() alone would hide one of
several symptom sites and change nothing on the write path.

This is fixed for all console UART drivers by a separate series [1],
"serial: fix console lifetime bugs on failed bind and removal" (1/4 moves
the fallible allocation before console registration); it reproduces this
exact pl011_console_write_thread oops and an i.MX use-after-free. So I'd
keep this series as-is.

[1] https://lore.kernel.org/all/20260719221014.44354-1-kmehltretter@xxxxxxxxx/