From: Tao Cui mount_opts.max == 0 is consumed as ida_alloc_max(..., max - 1), which wraps to 0xffffffff. The IDA layer treats a negative max as INT_MAX, so "mount -t devpts -o max=0" does not disable ptys - it lifts the per-instance limit entirely and only the global kernel.pty.max still applies. Reject the value at parse time: $ mount -t devpts -o max=0 pt /tmp/pt mount: /tmp/pt: wrong fs type, bad option, bad superblock... No userspace relies on 0 meaning "unlimited": runc and crun never set max=, and LXC, the only runtime that does, omits the property entirely when the configured value is 0. The value has never been validated since the option was introduced, so there is no Fixes tag. Signed-off-by: Tao Cui --- fs/devpts/inode.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c index 9844dcf354ee..bd1e8eb26edb 100644 --- a/fs/devpts/inode.c +++ b/fs/devpts/inode.c @@ -249,6 +249,8 @@ static int devpts_parse_param(struct fs_context *fc, struct fs_parameter *param) case Opt_max: if (result.uint_32 > NR_UNIX98_PTY_MAX) return invalf(fc, "max out of range"); + if (result.uint_32 == 0) + return invalf(fc, "max must be greater than 0"); opts->max = result.uint_32; break; } -- 2.43.0