linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: kernel test robot <oliver.sang@intel.com>,
	Yicong Yang <yangyicong@hisilicon.com>,
	oe-lkp@lists.linux.dev, lkp@intel.com,
	linux-kernel@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable <stable@kernel.org>,
	linux-serial@vger.kernel.org
Subject: Re: [linus:master] [serial]  43066e3222: BUG:kernel_NULL_pointer_dereference,address
Date: Thu, 4 Apr 2024 09:54:15 +0300	[thread overview]
Message-ID: <20240404065415.GO5132@atomide.com> (raw)
In-Reply-To: <Zg1hBvRAxifo50sf@smile.fi.intel.com>

* Andy Shevchenko <andriy.shevchenko@linux.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);

  reply	other threads:[~2024-04-04  6:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-03 13:43 [linus:master] [serial] 43066e3222: BUG:kernel_NULL_pointer_dereference,address kernel test robot
2024-04-03 14:00 ` Andy Shevchenko
2024-04-04  6:54   ` Tony Lindgren [this message]
2024-04-04 11:59     ` Andy Shevchenko
2024-04-04 14:42       ` Andy Shevchenko
2024-04-04 14:34     ` Andy Shevchenko
2024-04-05  5:46       ` Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240404065415.GO5132@atomide.com \
    --to=tony@atomide.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=oe-lkp@lists.linux.dev \
    --cc=oliver.sang@intel.com \
    --cc=stable@kernel.org \
    --cc=yangyicong@hisilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).