* [PATCH v3] pps: reject N_PPS on pseudo-terminals
@ 2026-11-20 10:14 Hungyu Lin
0 siblings, 0 replies; only message in thread
From: Hungyu Lin @ 2026-11-20 10:14 UTC (permalink / raw)
To: giometti; +Cc: akpm, linux-kernel, dennylin0707
Attaching N_PPS to a PTY registers a PPS source even though PTYs do not
report DCD changes. An unprivileged user can exhaust the PPS source IDs
this way, causing registration of a real PPS source to fail with
-EBUSY.
Reject N_PPS on PTYs before allocating a source.
Fixes: a0880df0ccde ("pps: serial clients support")
Suggested-by: Rodolfo Giometti <giometti@enneenne.com>
Acked-by: Rodolfo Giometti <giometti@enneenne.com>
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
---
Changes in v3:
- Add Rodolfo Giometti's Acked-by.
v2: https://lore.kernel.org/r/20261111132709.5959-1-dennylin0707@gmail.com
v1: https://lore.kernel.org/r/20261107211753.75932-1-dennylin0707@gmail.com
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..83f4caced0c9 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 (drv->type == TTY_DRIVER_TYPE_PTY)
+ return -EINVAL;
+
info.owner = THIS_MODULE;
info.dev = NULL;
snprintf(info.name, PPS_MAX_NAME_LEN, "%s%d", drv->driver_name, index);
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-20 10:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-20 10:14 [PATCH v3] pps: reject N_PPS on pseudo-terminals Hungyu Lin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®