[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <980d651a-af69-49de-bc53-a2e325bd4bb0@gmail.com>
Date: Mon, 27 Nov 2023 20:37:45 +0100
From: Heiner Kallweit <hkallweit1@...il.com>
To: ChunHao Lin <hau@...ltek.com>
Cc: nic_swsd@...ltek.com, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, grundler@...omium.org, stable@...r.kernel.org
Subject: Re: [PATCH net 2/2] r8169: fix deadlock in "r8169_phylink_handler"
On 27.11.2023 18:57, ChunHao Lin wrote:
> In "r8169_phylink_handler", for rtl8125, it will call "rtl_reset_work"->
> "rtl_hw_start"->"rtl_jumbo_config"->"phy_start_aneg". When call
> "r8169_phylink_handler", PHY lock is acquired. But "phy_start_aneg"
> will also try to acquire PHY lock. That will cause deadlock.
>
> In this path, use "_phy_start_aneg", unlocked version "phy_start_aneg",
> to prevent deadlock in "r8169_phylink_handler".
>
> Fixes: 453a77894efa ("r8169: don't advertise pause in jumbo mode")
> Cc: stable@...r.kernel.org
> Signed-off-by: ChunHao Lin <hau@...ltek.com>
> ---
> drivers/net/ethernet/realtek/r8169_main.c | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
> index 473b3245754f..2e3e42a98edd 100644
> --- a/drivers/net/ethernet/realtek/r8169_main.c
> +++ b/drivers/net/ethernet/realtek/r8169_main.c
> @@ -2415,11 +2415,22 @@ static void rtl_jumbo_config(struct rtl8169_private *tp)
>
> /* Chip doesn't support pause in jumbo mode */
> if (jumbo) {
> + int lock;
> +
> linkmode_clear_bit(ETHTOOL_LINK_MODE_Pause_BIT,
> tp->phydev->advertising);
> linkmode_clear_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT,
> tp->phydev->advertising);
> - phy_start_aneg(tp->phydev);
> +
> + if (!mutex_trylock(&tp->phydev->lock))
> + lock = 0;
> + else
> + lock = 1;
> +
> + _phy_start_aneg(tp->phydev);
> +
> + if (lock)
> + mutex_unlock(&tp->phydev->lock);
> }
> }
>
Hi Hau,
the deadlock issue has been reported by few users, and I submitted a fix already.
It's waiting to be applied.
Powered by blists - more mailing lists