Commit 0c73b9c1 authored by Heiner Kallweit's avatar Heiner Kallweit Committed by sanglipeng
Browse files

r8169: fix deadlock on RTL8125 in jumbo mtu mode

stable inclusion
from stable-v5.10.203
commit 2325d3b6b10f17b99d99e66692d2092d66c3eec4
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I9GXII

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=2325d3b6b10f17b99d99e66692d2092d66c3eec4



--------------------------------

[ Upstream commit 59d395ed606d8df14615712b0cdcdadb2d962175 ]

The original change results in a deadlock if jumbo mtu mode is used.
Reason is that the phydev lock is held when rtl_reset_work() is called
here, and rtl_jumbo_config() calls phy_start_aneg() which also tries
to acquire the phydev lock. Fix this by calling rtl_reset_work()
asynchronously.

Fixes: 621735f59064 ("r8169: fix rare issue with broken rx after link-down on RTL8125")
Reported-by: default avatarIan Chen <free122448@hotmail.com>
Tested-by: default avatarIan Chen <free122448@hotmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Link: https://lore.kernel.org/r/caf6a487-ef8c-4570-88f9-f47a659faf33@gmail.com


Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarsanglipeng <sanglipeng1@jd.com>
parent fc02bf35
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -582,6 +582,7 @@ struct rtl8169_tc_offsets {
enum rtl_flag {
	RTL_FLAG_TASK_ENABLED = 0,
	RTL_FLAG_TASK_RESET_PENDING,
	RTL_FLAG_TASK_RESET_NO_QUEUE_WAKE,
	RTL_FLAG_TASK_TX_TIMEOUT,
	RTL_FLAG_MAX
};
@@ -4684,6 +4685,8 @@ static void rtl_task(struct work_struct *work)
reset:
		rtl_reset_work(tp);
		netif_wake_queue(tp->dev);
	} else if (test_and_clear_bit(RTL_FLAG_TASK_RESET_NO_QUEUE_WAKE, tp->wk.flags)) {
		rtl_reset_work(tp);
	}
out_unlock:
	rtnl_unlock();
@@ -4717,7 +4720,7 @@ static void r8169_phylink_handler(struct net_device *ndev)
	} else {
		/* In few cases rx is broken after link-down otherwise */
		if (rtl_is_8125(tp))
			rtl_reset_work(tp);
			rtl_schedule_task(tp, RTL_FLAG_TASK_RESET_NO_QUEUE_WAKE);
		pm_runtime_idle(d);
	}