On Thu, Oct 01, 2026 at 12:55:52PM -0400, Akira Patafio wrote:
> 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. 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")
> Signed-off-by: Akira Patafio <[email protected]>
> ---
> The pre-fix EIO transition was reproduced on an Android 5.10.240 device.
> The new selftest cross-compiles for arm64 with -Werror. I have not booted
> a kernel with this patch yet.

If you haven't even tested or tried it yet, why should we?

{sigh}

Please test your work before sending it to us.

thanks,

greg k-h

Reply via email to