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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 4 Aug 2020 16:23:35 -0700
From:   Richard Cochran <richardcochran@...il.com>
To:     Vladimir Oltean <olteanv@...il.com>
Cc:     kuba@...nel.org, davem@...emloft.net, netdev@...r.kernel.org,
        jacob.e.keller@...el.com
Subject: Re: [PATCH net-next] ptp: only allow phase values lower than 1 period

On Mon, Aug 03, 2020 at 10:49:21PM +0300, Vladimir Oltean wrote:
> @@ -218,6 +218,19 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
>  					break;
>  				}
>  			}
> +			if (perout->flags & PTP_PEROUT_PHASE) {
> +				/*
> +				 * The phase should be specified modulo the
> +				 * period, therefore anything larger than 1
> +				 * period is invalid.
> +				 */
> +				if (perout->phase.sec > perout->period.sec ||
> +				    (perout->phase.sec == perout->period.sec &&
> +				     perout->phase.nsec > perout->period.nsec)) {
> +					err = -ERANGE;
> +					break;
> +				}

So if perout->period={1,0} and perout->phase={1,0} then the phase has
wrapped 360 degrees back to zero.

Shouldn't this code catch that case as well?

So why not test for (perout->phase.nsec >= perout->period.nsec) instead?

Thanks,
Richard

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ