Re: test fix

From: syzbot

Date: Thu Sep 24 2026 - 15:17:39 EST


> #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

This crash does not have a reproducer. I cannot test it.

> master
>
> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> index 95774b0f1484..030735da6b8c 100644
> --- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
> @@ -3210,8 +3210,15 @@ static void serial_core_remove_one_port(struct
> uart_driver *drv,
> /*
> * If the port is used as a console, unregister it
> */
> - if (uart_console(uport))
> + if (uart_console(uport)) {
> unregister_console(uport->cons);
> + port->console = false;
> + }
> +
> + guard(mutex)(&port->mutex);
> +
> + if (tty_port_initialized(port))
> + uart_shutdown(NULL, state);
>
> /*
> * Free the port IO and memory resources, if any.
> @@ -3227,7 +3234,6 @@ static void serial_core_remove_one_port(struct
> uart_driver *drv,
> uport->type = PORT_UNKNOWN;
> uport->port_dev = NULL;
>
> - guard(mutex)(&port->mutex);
> WARN_ON(atomic_dec_return(&state->refcount) < 0);
> wait_event(state->remove_wait, !atomic_read(&state->refcount));
> state->uart_port = NULL;