From: Fushuai Wang <fushuai.wang@linux.dev>
To: gregkh@linuxfoundation.org, jirislaby@kernel.org,
ilpo.jarvinen@linux.intel.com, osama.abdelkader@gmail.com,
andy.shevchenko@gmail.com, jackzxcui1989@163.com,
kees@kernel.org, sean@mess.org, alan@linux.intel.com
Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
wangfushuai@baidu.com
Subject: [PATCH v3] serial: 8250: Clear CON_PRINTBUFFER on port re-registration
Date: Fri, 22 May 2026 18:10:42 +0800 [thread overview]
Message-ID: <20260522101042.21976-1-fushuai.wang@linux.dev> (raw)
From: Fushuai Wang <wangfushuai@baidu.com>
When two PnP devices map to the same physical port, the serial8250 driver
removes and re-registers the console structure for the same port.
During re-registration, the console structure still has CON_PRINTBUFFER set
from the initial registration, which causes console_init_seq() to set
console->seq to syslog_seq. This results in re-printing the entire
system log buffer, which may lead to RCU stall on slow serial consoles.
Clear CON_PRINTBUFFER when re-registering a port to prevent duplicate
log printing.
Fixes: 835d844d1a28 ("8250_pnp: do pnp probe before legacy probe")
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Fushuai Wang <wangfushuai@baidu.com>
---
V2->V3: Clear CON_PRINTBUFFER when remove the port
V1->V2: Add Fixes tag
drivers/tty/serial/8250/8250_core.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
index a428e88938eb..5419f1d22d47 100644
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
@@ -716,8 +716,12 @@ int serial8250_register_8250_port(const struct uart_8250_port *up)
if (uart->port.type == PORT_8250_CIR)
return -ENODEV;
- if (uart->port.dev)
+ if (uart->port.dev) {
+ if (uart_console(&uart->port))
+ uart->port.cons->flags &= ~CON_PRINTBUFFER;
+
uart_remove_one_port(&serial8250_reg, &uart->port);
+ }
uart->port.ctrl_id = up->port.ctrl_id;
uart->port.port_id = up->port.port_id;
--
2.36.1
next reply other threads:[~2026-05-22 10:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-22 10:10 Fushuai Wang [this message]
2026-06-03 6:56 ` [PATCH v3] serial: 8250: Clear CON_PRINTBUFFER on port re-registration Fushuai Wang
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=20260522101042.21976-1-fushuai.wang@linux.dev \
--to=fushuai.wang@linux.dev \
--cc=alan@linux.intel.com \
--cc=andy.shevchenko@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jackzxcui1989@163.com \
--cc=jirislaby@kernel.org \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=osama.abdelkader@gmail.com \
--cc=sean@mess.org \
--cc=wangfushuai@baidu.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