linux/fs/devpts
Tao Cui 7d1d1a34d2
devpts: reject max=0 instead of silently lifting the limit
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 <cuitao@kylinos.cn>
Link: https://patch.msgid.link/20260903033625.1042796-1-cui.tao@linux.dev
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
2026-09-04 12:57:46 +02:00
..
inode.c devpts: reject max=0 instead of silently lifting the limit 2026-09-04 12:57:46 +02:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00