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: <b8aba366-b5e9-3563-5708-904f6aec617c@samsung.com>
Date: Mon, 18 Sep 2023 15:15:46 +0200
From: Marek Szyprowski <m.szyprowski@...sung.com>
To: "Russell King (Oracle)" <linux@...linux.org.uk>
Cc: Andrew Lunn <andrew@...n.ch>, Heiner Kallweit <hkallweit1@...il.com>,
	chenhao418@...wei.com, "David S. Miller" <davem@...emloft.net>, Eric Dumazet
	<edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Jijie Shao
	<shaojijie@...wei.com>, lanhao@...wei.com, liuyonglong@...wei.com,
	netdev@...r.kernel.org, Paolo Abeni <pabeni@...hat.com>,
	shenjian15@...wei.com, wangjie125@...wei.com, wangpeiyang1@...wei.com
Subject: Re: [PATCH net-next 1/7] net: phy: always call
 phy_process_state_change() under lock

On 18.09.2023 15:06, Russell King (Oracle) wrote:
> On Mon, Sep 18, 2023 at 02:33:04PM +0200, Marek Szyprowski wrote:
>> Hi Russell,
>>
>> On 14.09.2023 17:35, Russell King (Oracle) wrote:
>>> phy_stop() calls phy_process_state_change() while holding the phydev
>>> lock, so also arrange for phy_state_machine() to do the same, so that
>>> this function is called with consistent locking.
>>>
>>> Tested-by: Jijie Shao <shaojijie@...wei.com>
>>> Signed-off-by: Russell King (Oracle) <rmk+kernel@...linux.org.uk>
>> This change, merged to linux-next as commit 8da77df649c4 ("net: phy:
>> always call phy_process_state_change() under lock") introduces the
>> following deadlock with ASIX AX8817X USB driver:
> Yay, latent bug found...
>
> I guess this is asix_ax88772a_link_change_notify() which is causing
> the problem, and yes, that phy_start_aneg() needs to be the unlocked
> version (which we'll have to export.)
>
> This should fix it.

Thanks!

Reported-by: Marek Szyprowski <m.szyprowski@...sung.com>

Tested-by: Marek Szyprowski <m.szyprowski@...sung.com>


> diff --git a/drivers/net/phy/ax88796b.c b/drivers/net/phy/ax88796b.c
> index 0f1e617a26c9..eb74a8cf8df1 100644
> --- a/drivers/net/phy/ax88796b.c
> +++ b/drivers/net/phy/ax88796b.c
> @@ -90,7 +90,7 @@ static void asix_ax88772a_link_change_notify(struct phy_device *phydev)
>   	 */
>   	if (phydev->state == PHY_NOLINK) {
>   		phy_init_hw(phydev);
> -		phy_start_aneg(phydev);
> +		_phy_start_aneg(phydev);
>   	}
>   }
>   
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index 93a8676dd8d8..a5fa077650e8 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -981,7 +981,7 @@ static int phy_check_link_status(struct phy_device *phydev)
>    *   If the PHYCONTROL Layer is operating, we change the state to
>    *   reflect the beginning of Auto-negotiation or forcing.
>    */
> -static int _phy_start_aneg(struct phy_device *phydev)
> +int _phy_start_aneg(struct phy_device *phydev)
>   {
>   	int err;
>   
> @@ -1002,6 +1002,7 @@ static int _phy_start_aneg(struct phy_device *phydev)
>   
>   	return err;
>   }
> +EXPORT_SYMBOL(_phy_start_aneg);
>   
>   /**
>    * phy_start_aneg - start auto-negotiation for this PHY device
> diff --git a/include/linux/phy.h b/include/linux/phy.h
> index 1351b802ffcf..3cc52826f18e 100644
> --- a/include/linux/phy.h
> +++ b/include/linux/phy.h
> @@ -1736,6 +1736,7 @@ void phy_detach(struct phy_device *phydev);
>   void phy_start(struct phy_device *phydev);
>   void phy_stop(struct phy_device *phydev);
>   int phy_config_aneg(struct phy_device *phydev);
> +int _phy_start_aneg(struct phy_device *phydev);
>   int phy_start_aneg(struct phy_device *phydev);
>   int phy_aneg_done(struct phy_device *phydev);
>   int phy_speed_down(struct phy_device *phydev, bool sync);

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ