Re: [PATCH] devpts: fix pty count limit off by one

Greg KH <[email protected]> Tue, 4 Aug 2026 10:40:26 +0200
Newsgroups gmane.linux.kernel,gmane.linux.serial
Message-ID <2026080419-chatting-curve-e49c@gregkh>
On Tue, Aug 04, 2026 at 04:23:21PM +0800, Yichong Chen wrote:
> devpts_new_index() increments the global pty count before checking it
> against the effective global limit. The check currently rejects a new pty
> when the incremented count is equal to the limit.
> 
> This makes kernel.pty.max allow only max - 1 ptys. For example, if
> kernel.pty.nr is 3 and kernel.pty.max is set to 4, opening /dev/ptmx
> fails with -ENOSPC even though one more pty should be allowed.
> 
> Allow the incremented count to be equal to the effective limit and reject
> only counts above it.
> 
> Fixes: 0f0a0e54a2a1 ("devpts: Convert to new IDA API")

As this is a user-visible change, what is now going to break because of
this?  It's been this way for a very long time now.

thanks,

greg k-h