mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hungyu Lin <dennylin0707@gmail.com>
To: giometti@enneenne.com
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	dennylin0707@gmail.com
Subject: [PATCH] pps: require CAP_SYS_TIME to attach N_PPS ldisc
Date: Sat,  7 Nov 2026 21:17:53 +0000	[thread overview]
Message-ID: <20261107211753.75932-1-dennylin0707@gmail.com> (raw)

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@vger.kernel.org
Signed-off-by: Hungyu Lin <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..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

                 reply	other threads:[~2026-11-07 21:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261107211753.75932-1-dennylin0707@gmail.com \
    --to=dennylin0707@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=giometti@enneenne.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®