lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200524191342.GA9031@renesas.com>
Date:   Sun, 24 May 2020 15:13:43 -0400
From:   Vincent Cheng <vincent.cheng.xh@...esas.com>
To:     Richard Cochran <richardcochran@...il.com>
Cc:     netdev@...r.kernel.org, David Miller <davem@...emloft.net>,
        Miroslav Lichvar <mlichvar@...hat.com>,
        John Stultz <john.stultz@...aro.org>
Subject: Re: [PATCH net-next V2] Let the ADJ_OFFSET interface respect the
 ADJ_NANO flag for PHC devices.

On Sun, May 24, 2020 at 02:27:10PM EDT, Richard Cochran wrote:
>In commit 184ecc9eb260d5a3bcdddc5bebd18f285ac004e9 ("ptp: Add adjphase
>function to support phase offset control.") the PTP Hardware Clock
>interface expanded to support the ADJ_OFFSET offset mode.  However,
>the implementation did not respect the traditional yet pedantic
>distinction between units of microseconds and nanoseconds signaled by
>the ADJ_NANO flag.  This patch fixes the issue by adding logic to
>handle that flag.
>
>Signed-off-by: Richard Cochran <richardcochran@...il.com>
>---
> drivers/ptp/ptp_clock.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
>index fc984a8828fb..03a246e60fd9 100644
>--- a/drivers/ptp/ptp_clock.c
>+++ b/drivers/ptp/ptp_clock.c
>@@ -147,8 +147,14 @@ static int ptp_clock_adjtime(struct posix_clock *pc, struct __kernel_timex *tx)
> 			err = ops->adjfreq(ops, ppb);
> 		ptp->dialed_frequency = tx->freq;
> 	} else if (tx->modes & ADJ_OFFSET) {
>-		if (ops->adjphase)
>-			err = ops->adjphase(ops, tx->offset);
>+		if (ops->adjphase) {
>+			s32 offset = tx->offset;
>+
>+			if (!(tx->modes & ADJ_NANO))
>+				offset *= NSEC_PER_USEC;
>+
>+			err = ops->adjphase(ops, offset);
>+		}
> 	} else if (tx->modes == 0) {
> 		tx->freq = ptp->dialed_frequency;
> 		err = 0;
>-- 

Hi Richard,

Oops.  Thank-you for the fix.

Thanks,
Vincent

Reviewed-by: Vincent Cheng <vincent.cheng.xh@...esas.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ