From: sashiko-bot@kernel.org
To: "Akira Patafio" <kokokoala4211@gmail.com>
Cc: linux-serial@vger.kernel.org
Subject: Re: [PATCH v2] tty: pty: preserve open slaves after rejected locked open
Date: Sat, 03 Oct 2026 01:33:55 +0000 [thread overview]
Message-ID: <20261003013356.381CC1F00899@smtp.kernel.org> (raw)
In-Reply-To: <20261002202455.25324-1-kokokoala4211@gmail.com>
> Opening a locked PTY slave fails with EIO, but the failure path sets
> TTY_IO_ERROR on the shared slave tty. Previously opened slave files then
> fail I/O even though their master is still open.
>
> tty_open() releases a file after the slave open callback fails. Merely
> skipping TTY_IO_ERROR on the rejected open is insufficient: pty_close()
> can mistake the failed file for the last slave and close the master.
> Counting tty references is also insufficient because a real last close
> can race the failed open and its release.
>
> Track which slave files opened successfully. Ignore failed files during
> close, and mark the master peer closed only when the last successful
> slave file closes. In-kernel callers may pass NULL instead of a file;
> retain the count-based close behavior for those callers. A selftest
> checks locked opens with zero, one, and two existing slave files, plus
> ordinary last-slave close behavior.
>
> Fixes: 699390354da6 ("pty: Ignore slave pty close() if never successfully opened")
> Assisted-by: LLM
> Signed-off-by: Akira Patafio <kokokoala4211@gmail.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261002202455.25324-1-kokokoala4211@gmail.com?part=1
next prev parent reply other threads:[~2026-10-03 1:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-01 16:55 [PATCH] tty: pty: preserve open slaves after rejected locked open Akira Patafio
2026-10-01 17:12 ` sashiko-bot
2026-10-02 5:50 ` Greg KH
2026-10-02 5:50 ` Greg KH
2026-10-02 20:24 ` [PATCH v2] " Akira Patafio
2026-10-03 1:33 ` sashiko-bot [this message]
2026-10-04 12:45 ` Greg KH
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=20261003013356.381CC1F00899@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kokokoala4211@gmail.com \
--cc=linux-serial@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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