[PATCH] pps: require CAP_SYS_TIME to attach N_PPS ldisc
From: Hungyu Lin
Date: Sat Nov 07 2026 - 16:26:22 EST
Any unprivileged user can attach the N_PPS ldisc to a pty, and every
attach registers a PPS source. At most PPS_MAX_SOURCES (256) sources can
exist, so such a user can take all of them, after which registering a
real PPS source fails with -EBUSY.
Require CAP_SYS_TIME to attach N_PPS, the capability that PPS_SETPARAMS
already needs to configure a source.
Fixes: a0880df0ccde ("pps: serial clients support")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Hungyu Lin <dennylin0707@xxxxxxxxx>
---
drivers/pps/clients/pps-ldisc.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/pps/clients/pps-ldisc.c b/drivers/pps/clients/pps-ldisc.c
index fa5660f3c4b7..54678f20edd5 100644
--- a/drivers/pps/clients/pps-ldisc.c
+++ b/drivers/pps/clients/pps-ldisc.c
@@ -46,6 +46,9 @@ static int pps_tty_open(struct tty_struct *tty)
struct pps_device *pps;
int ret;
+ if (!capable(CAP_SYS_TIME))
+ return -EPERM;
+
info.owner = THIS_MODULE;
info.dev = NULL;
snprintf(info.name, PPS_MAX_NAME_LEN, "%s%d", drv->driver_name, index);
--
2.43.0