Skip to content

Commit 59d395e

Browse files
hkallweitPaolo Abeni
authored andcommitted
r8169: fix deadlock on RTL8125 in jumbo mtu mode
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: 621735f ("r8169: fix rare issue with broken rx after link-down on RTL8125") Reported-by: Ian Chen <free122448@hotmail.com> Tested-by: Ian Chen <free122448@hotmail.com> Cc: stable@vger.kernel.org Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Link: https://lore.kernel.org/r/caf6a487-ef8c-4570-88f9-f47a659faf33@gmail.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent 45b3fae commit 59d395e

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

drivers/net/ethernet/realtek/r8169_main.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,7 @@ struct rtl8169_tc_offsets {
579579
enum rtl_flag {
580580
RTL_FLAG_TASK_ENABLED = 0,
581581
RTL_FLAG_TASK_RESET_PENDING,
582+
RTL_FLAG_TASK_RESET_NO_QUEUE_WAKE,
582583
RTL_FLAG_TASK_TX_TIMEOUT,
583584
RTL_FLAG_MAX
584585
};
@@ -4582,6 +4583,8 @@ static void rtl_task(struct work_struct *work)
45824583
reset:
45834584
rtl_reset_work(tp);
45844585
netif_wake_queue(tp->dev);
4586+
} else if (test_and_clear_bit(RTL_FLAG_TASK_RESET_NO_QUEUE_WAKE, tp->wk.flags)) {
4587+
rtl_reset_work(tp);
45854588
}
45864589
out_unlock:
45874590
rtnl_unlock();
@@ -4615,7 +4618,7 @@ static void r8169_phylink_handler(struct net_device *ndev)
46154618
} else {
46164619
/* In few cases rx is broken after link-down otherwise */
46174620
if (rtl_is_8125(tp))
4618-
rtl_reset_work(tp);
4621+
rtl_schedule_task(tp, RTL_FLAG_TASK_RESET_NO_QUEUE_WAKE);
46194622
pm_runtime_idle(d);
46204623
}
46214624

0 commit comments

Comments
 (0)