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:   Mon, 22 Feb 2021 19:00:51 -0800
From:   Jakub Kicinski <kuba@...nel.org>
To:     Heiko Thiery <heiko.thiery@...il.com>
Cc:     linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
        "David S . Miller" <davem@...emloft.net>,
        Fugang Duan <fugang.duan@....com>,
        Richard Cochran <richardcochran@...il.com>
Subject: Re: [PATCH 1/1] net: fec: ptp: avoid register access when ipg clock
 is disabled

On Sat, 20 Feb 2021 07:56:55 +0100 Heiko Thiery wrote:
> When accessing the timecounter register on an i.MX8MQ the kernel hangs.
> This is only the case when the interface is down. This can be reproduced
> by reading with 'phc_ctrl eth0 get'.
> 
> Like described in the change in 91c0d987a9788dcc5fe26baafd73bf9242b68900
> the igp clock is disabled when the interface is down and leads to a
> system hang.
> 
> So we check if the ptp clock status before reading the timecounter
> register.
> 
> Signed-off-by: Heiko Thiery <heiko.thiery@...il.com>

Please widen the CC list, you should CC Richard on PTP patches.

> diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c
> index 2e344aada4c6..c9882083da02 100644
> --- a/drivers/net/ethernet/freescale/fec_ptp.c
> +++ b/drivers/net/ethernet/freescale/fec_ptp.c
> @@ -377,6 +377,9 @@ static int fec_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts)
>  	u64 ns;
>  	unsigned long flags;
>  
> +	/* Check the ptp clock */

Comment is rather redundant. Drop it or say _when_ ptp_clk_on may not
be true.

> +	if (!adapter->ptp_clk_on)
> +		return -EINVAL;

Why is the PTP interface registered when it can't be accessed?

Perhaps the driver should unregister the PTP clock when it's brought
down?

>  	spin_lock_irqsave(&adapter->tmreg_lock, flags);
>  	ns = timecounter_read(&adapter->tc);
>  	spin_unlock_irqrestore(&adapter->tmreg_lock, flags);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ