mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Phil Rosenthal <phil@phil.gs>
To: Igor Putko <igorpetindev@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>, Rob Herring <robh@kernel.org>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	"linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"syzbot+843bf2f48f4d12e6682e@syzkaller.appspotmail.com"
	<syzbot+843bf2f48f4d12e6682e@syzkaller.appspotmail.com>
Subject: Re: [PATCH v2] serial: core: shut down initialized port on removal
Date: Tue, 13 Oct 2026 16:45:20 +0000	[thread overview]
Message-ID: <B3A8B8AA-AFE1-4545-A38B-DBB8BCC83830@phil.gs> (raw)
In-Reply-To: <20261003163337.45577-1-igorpetindev@gmail.com>

On Sat, Oct 03, 2026 at 07:33:37PM +0300, Igor Putko wrote:
> Fix this by acquiring port->mutex in serial_core_remove_one_port() after
> console unregistration, clearing port->console under the mutex to prevent
> data races with concurrent tty_port_shutdown(), and invoking
> uart_shutdown(NULL, state) if the port remains initialized.

I sent a patch for the same bug [1] without having seen this one. I
ran my reproducers on tty-next 36844ea19656 plus this commit
(810d467c11f0 in tty-testing), in a QEMU guest with KASAN. The 8250_pci
case with INTx is fixed: the IRQ is freed on unbind, reading
/proc/interrupts is clean and rebinding restores the console. It also
fixes a second symptom, on a polled port (irq 0, UPF_IOREMAP), where
serial8250_timeout() kept running after removal and dereferenced the
cleared membase. A port held open across removal and a console that
was never opened still work.

Tested-by: Phil Rosenthal <phil@phil.gs>

The patch uses scoped_guard(), which exists for mutexes from v6.5, so
it won't build on the 6.1, 5.15 and 5.10 stable trees. If you don't
plan to send backports for those, I can.

[1] https://lore.kernel.org/r/20261013-serial-console-remove-v2-1-2eca1a92c10d@phil.gs

Thanks,
Phil


      reply	other threads:[~2026-10-13 16:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-24 19:22 [PATCH] " Igor Putko
2026-09-25  5:34 ` Greg Kroah-Hartman
2026-09-26 13:05 ` IgorpetinDev
2026-10-01  8:58   ` Greg KH
2026-10-03 16:33 ` [PATCH v2] " Igor Putko
2026-10-13 16:45   ` Phil Rosenthal [this message]

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=B3A8B8AA-AFE1-4545-A38B-DBB8BCC83830@phil.gs \
    --to=phil@phil.gs \
    --cc=gregkh@linuxfoundation.org \
    --cc=igorpetindev@gmail.com \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=syzbot+843bf2f48f4d12e6682e@syzkaller.appspotmail.com \
    --cc=vigneshr@ti.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

all inboxes | Powered by JetHome®