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:   Sun, 01 Mar 2020 23:52:16 +0100
From:   Michael Walle <michael@...le.cc>
To:     Heiner Kallweit <hkallweit1@...il.com>
Cc:     Andrew Lunn <andrew@...n.ch>,
        Florian Fainelli <f.fainelli@...il.com>,
        Russell King - ARM Linux <linux@...linux.org.uk>,
        David Miller <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: [PATCH net] net: phy: avoid clearing PHY interrupts twice in irq
 handler

Am 2020-03-01 21:36, schrieb Heiner Kallweit:
> On all PHY drivers that implement did_interrupt() reading the interrupt
> status bits clears them. This means we may loose an interrupt that
> is triggered between calling did_interrupt() and phy_clear_interrupt().
> As part of the fix make it a requirement that did_interrupt() clears
> the interrupt.

Looks good. But how would you use did_interrupt() and handle_interrupt()
together? I guess you can't. At least not if handle_interrupt() has
to read the pending bits again. So you'd have to handle custom
interrupts in did_interrupt(). Any idea how to solve that?

[I know, this is only about fixing the lost interrupts.]

-michael

> 
> The Fixes tag refers to the first commit where the patch applies
> cleanly.
> 
> Fixes: 49644e68f472 ("net: phy: add callback for custom interrupt
> handler to struct phy_driver")
> Reported-by: Michael Walle <michael@...le.cc>
> Signed-off-by: Heiner Kallweit <hkallweit1@...il.com>
> ---
>  drivers/net/phy/phy.c | 3 ++-
>  include/linux/phy.h   | 1 +
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index d76e038cf..16e3fb79e 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -727,7 +727,8 @@ static irqreturn_t phy_interrupt(int irq, void 
> *phy_dat)
>  		phy_trigger_machine(phydev);
>  	}
> 
> -	if (phy_clear_interrupt(phydev))
> +	/* did_interrupt() may have cleared the interrupt already */
> +	if (!phydev->drv->did_interrupt && phy_clear_interrupt(phydev))
>  		goto phy_err;
>  	return IRQ_HANDLED;
> 
> diff --git a/include/linux/phy.h b/include/linux/phy.h
> index 80f8b2158..8b299476b 100644
> --- a/include/linux/phy.h
> +++ b/include/linux/phy.h
> @@ -557,6 +557,7 @@ struct phy_driver {
>  	/*
>  	 * Checks if the PHY generated an interrupt.
>  	 * For multi-PHY devices with shared PHY interrupt pin
> +	 * Set interrupt bits have to be cleared.
>  	 */
>  	int (*did_interrupt)(struct phy_device *phydev);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ