[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZuA08ew8aNb8P_n4@localhost>
Date: Tue, 10 Sep 2024 14:00:49 +0200
From: Miroslav Lichvar <mlichvar@...hat.com>
To: Richard Cochran <richardcochran@...il.com>
Cc: linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
John Stultz <jstultz@...gle.com>, Arnd Bergmann <arnd@...db.de>
Subject: Re: [PATCH] ptp: Limit time setting of PTP clocks
On Mon, Sep 09, 2024 at 08:48:24AM -0700, Richard Cochran wrote:
> > diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
> > index c56cd0f63909..bd7c5f534be6 100644
> > --- a/drivers/ptp/ptp_clock.c
> > +++ b/drivers/ptp/ptp_clock.c
> > @@ -100,6 +100,9 @@ static int ptp_clock_settime(struct posix_clock *pc, const struct timespec64 *tp
> > return -EBUSY;
> > }
> >
> > + if (!timespec64_valid_settod(tp))
> > + return -EINVAL;
>
> Why not perform the test earlier, in SYSCALL_DEFINE2(clock_settime, ...) ?
It would be more code as there are also the 32-bit compat variants of
the functions. The adjtime function would probably need to handle
missing gettime.
The limit would apply to all clocks, not just PTP clocks. If nothing
else, I suspect it would change returned errors for other clocks
trying to set the an unacceptable timespec value.
--
Miroslav Lichvar
Powered by blists - more mailing lists