From: Johan Hovold <johan@kernel.org>
To: Hengyu Liang <hengyul@cs.unc.edu>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] serial: core: fix TIOCSSERIAL and TIOCSERCONFIG on uninitialised ports
Date: Sun, 11 Oct 2026 14:16:37 +0200 [thread overview]
Message-ID: <ast-JWIDzyly6WuI@hovoldconsulting.com> (raw)
In-Reply-To: <20261010034616.3915864-1-hengyul@cs.unc.edu>
On Fri, Oct 09, 2026 at 11:46:16PM -0400, Hengyu Liang wrote:
> Commit 8ca59f7baee7 ("serial: fix ioctl hangup race") made
> uart_set_info() and uart_do_autoconfig() return -EIO when TTY_IO_ERROR
> is set, so that they do not run on a port that has been hung up.
>
> However, TTY_IO_ERROR is also set on a port that could not be started,
> for example because its type is unknown, and by uart_shutdown(), which
> both functions call. As of now, setserial cannot configure a port that
> the kernel did not detect, and an autoconfig that follows a port, irq or
> type change in the same setserial call fails on any port.
Thanks for catching this.
How did you find it by the way? I assume you are not using an ISA serial
card?
> This patch will check tty_port_active() in these two functions instead.
> uart_hangup() clears it under the port mutex, and it stays set on an
> open port that could not be started.
Yeah, this should work. (And the flag is now also cleared under the port
mutex by tty_port_hangup(), which serial core currently does not use.)
> Fixes: 8ca59f7baee7 ("serial: fix ioctl hangup race")
> Cc: stable@vger.kernel.org
> Signed-off-by: Hengyu Liang <hengyul@cs.unc.edu>
> ---
> Commit 8ca59f7baee7 is in the stable queue for 7.2.
>
> Tested on v7.3-rc6 in QEMU (8250). A TIOCSSERIAL that is held in
> copy_from_user() with userfaultfd while the tty is hung up with
> TIOCVHANGUP still gets -EIO from uart_set_info() with this patch.
Tested-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Johan Hovold <johan@kernel.org>
Johan
next prev parent reply other threads:[~2026-10-11 12:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-10 3:46 Hengyu Liang
2026-10-10 6:16 ` Sasha Levin
2026-10-11 12:16 ` Johan Hovold [this message]
2026-10-11 15:00 ` Hengyu Liang
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=ast-JWIDzyly6WuI@hovoldconsulting.com \
--to=johan@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=hengyul@cs.unc.edu \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=stable@vger.kernel.org \
/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®