[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 4 Apr 2024 09:54:15 +0300
From: Tony Lindgren <tony@...mide.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: kernel test robot <oliver.sang@...el.com>,
Yicong Yang <yangyicong@...ilicon.com>, oe-lkp@...ts.linux.dev,
lkp@...el.com, linux-kernel@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable <stable@...nel.org>, linux-serial@...r.kernel.org
Subject: Re: [linus:master] [serial] 43066e3222:
BUG:kernel_NULL_pointer_dereference,address
* Andy Shevchenko <andriy.shevchenko@...ux.intel.com> [240403 14:00]:
> Probably we need to check if the port is still open...
>
> P.S. AFAIU the state / xmit is invalid pointer or so.
>
> Culprit line: serial_out(up, UART_TX, xmit->buf[xmit->tail]);
Maybe we can set UPF_DEAD a bit earlier as below?
Regards,
Tony
8< ---------------------------
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -3442,8 +3442,6 @@ void serial_core_unregister_port(struct uart_driver *drv, struct uart_port *port
mutex_lock(&port_mutex);
- port->flags |= UPF_DEAD;
-
serial_core_remove_one_port(drv, port);
/* Note that struct uart_port *port is no longer valid at this point */
diff --git a/drivers/tty/serial/serial_port.c b/drivers/tty/serial/serial_port.c
index 22b9eeb23e68a..1571ef721ef10 100644
--- a/drivers/tty/serial/serial_port.c
+++ b/drivers/tty/serial/serial_port.c
@@ -104,6 +104,7 @@ EXPORT_SYMBOL(uart_add_one_port);
void uart_remove_one_port(struct uart_driver *drv, struct uart_port *port)
{
+ port->flags |= UPF_DEAD;
serial_ctrl_unregister_port(drv, port);
}
EXPORT_SYMBOL(uart_remove_one_port);
Powered by blists - more mailing lists