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]
Message-ID: <YyshEGhh7zr+gXpa@hoboy.vegasvil.org>
Date:   Wed, 21 Sep 2022 07:34:56 -0700
From:   Richard Cochran <richardcochran@...il.com>
To:     Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>
Cc:     kishon@...com, vkoul@...nel.org, davem@...emloft.net,
        edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
        robh+dt@...nel.org, krzysztof.kozlowski+dt@...aro.org,
        geert+renesas@...der.be, andrew@...n.ch,
        linux-phy@...ts.infradead.org, netdev@...r.kernel.org,
        devicetree@...r.kernel.org, linux-renesas-soc@...r.kernel.org
Subject: Re: [PATCH v2 6/8] net: ethernet: renesas: rswitch: Add R-Car Gen4
 gPTP support

On Wed, Sep 21, 2022 at 05:47:43PM +0900, Yoshihiro Shimoda wrote:

> +static int rcar_gen4_ptp_gettime(struct ptp_clock_info *ptp,
> +				 struct timespec64 *ts)
> +{
> +	struct rcar_gen4_ptp_private *ptp_priv = ptp_to_priv(ptp);
> +
> +	ts->tv_nsec = ioread32(ptp_priv->addr + ptp_priv->offs->monitor_t0);
> +	ts->tv_sec = ioread32(ptp_priv->addr + ptp_priv->offs->monitor_t1) |
> +		     ((s64)ioread32(ptp_priv->addr + ptp_priv->offs->monitor_t2) << 32);

No locking here ...

> +	return 0;
> +}
> +
> +static int rcar_gen4_ptp_settime(struct ptp_clock_info *ptp,
> +				 const struct timespec64 *ts)
> +{
> +	struct rcar_gen4_ptp_private *ptp_priv = ptp_to_priv(ptp);
> +
> +	iowrite32(1, ptp_priv->addr + ptp_priv->offs->disable);
> +	iowrite32(0, ptp_priv->addr + ptp_priv->offs->config_t2);
> +	iowrite32(0, ptp_priv->addr + ptp_priv->offs->config_t1);
> +	iowrite32(0, ptp_priv->addr + ptp_priv->offs->config_t0);
> +	iowrite32(1, ptp_priv->addr + ptp_priv->offs->enable);
> +	iowrite32(ts->tv_sec >> 32, ptp_priv->addr + ptp_priv->offs->config_t2);
> +	iowrite32(ts->tv_sec, ptp_priv->addr + ptp_priv->offs->config_t1);
> +	iowrite32(ts->tv_nsec, ptp_priv->addr + ptp_priv->offs->config_t0);

... or here?

You need to protect multiple register access against concurrent callers.

Thanks,
Richard

> +	return 0;
> +}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ