mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: ChunHao Lin <hau@realtek.com>
Cc: nic_swsd@realtek.com, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, grundler@chromium.org,
	stable@vger.kernel.org
Subject: Re: [PATCH net 2/2] r8169: fix deadlock in "r8169_phylink_handler"
Date: Mon, 27 Nov 2023 20:37:45 +0100	[thread overview]
Message-ID: <980d651a-af69-49de-bc53-a2e325bd4bb0@gmail.com> (raw)
In-Reply-To: <20231127175736.5738-3-hau@realtek.com>

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@vger.kernel.org
> Signed-off-by: ChunHao Lin <hau@realtek.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.

      reply	other threads:[~2023-11-27 19:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-27 17:57 [PATCH net 0/2] r8169: fix PAUSE frames blasting issue ChunHao Lin
2023-11-27 17:57 ` [PATCH net 1/2] r8169: enable rtl8125b pause slot ChunHao Lin
2023-11-27 20:03   ` Heiner Kallweit
2023-11-27 20:28     ` Grant Grundler
2023-11-29 15:08     ` Hau
2023-11-27 17:57 ` [PATCH net 2/2] r8169: fix deadlock in "r8169_phylink_handler" ChunHao Lin
2023-11-27 19:37   ` Heiner Kallweit [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=980d651a-af69-49de-bc53-a2e325bd4bb0@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=grundler@chromium.org \
    --cc=hau@realtek.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nic_swsd@realtek.com \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®