Patch "r8169: prevent potential deadlock in rtl8169_close" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    r8169: prevent potential deadlock in rtl8169_close

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     r8169-prevent-potential-deadlock-in-rtl8169_close.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit bdc481a48c03698a02ef11eb49229620255ca6b6
Author: Heiner Kallweit <hkallweit1@xxxxxxxxx>
Date:   Sun Nov 26 23:01:02 2023 +0100

    r8169: prevent potential deadlock in rtl8169_close
    
    [ Upstream commit 91d3d149978ba7b238198dd80e4b823756aa7cfa ]
    
    ndo_stop() is RTNL-protected by net core, and the worker function takes
    RTNL as well. Therefore we will deadlock when trying to execute a
    pending work synchronously. To fix this execute any pending work
    asynchronously. This will do no harm because netif_running() is false
    in ndo_stop(), and therefore the work function is effectively a no-op.
    However we have to ensure that no task is running or pending after
    rtl_remove_one(), therefore add a call to cancel_work_sync().
    
    Fixes: abe5fc42f9ce ("r8169: use RTNL to protect critical sections")
    Signed-off-by: Heiner Kallweit <hkallweit1@xxxxxxxxx>
    Link: https://lore.kernel.org/r/12395867-1d17-4cac-aa7d-c691938fcddf@xxxxxxxxx
    Signed-off-by: Paolo Abeni <pabeni@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
index 770391cefb4e4..d293c996252cd 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -4656,7 +4656,7 @@ static int rtl8169_close(struct net_device *dev)
 	rtl8169_down(tp);
 	rtl8169_rx_clear(tp);
 
-	cancel_work_sync(&tp->wk.work);
+	cancel_work(&tp->wk.work);
 
 	free_irq(tp->irq, tp);
 
@@ -4890,6 +4890,8 @@ static void rtl_remove_one(struct pci_dev *pdev)
 	if (pci_dev_run_wake(pdev))
 		pm_runtime_get_noresume(&pdev->dev);
 
+	cancel_work_sync(&tp->wk.work);
+
 	unregister_netdev(tp->dev);
 
 	if (tp->dash_type != RTL_DASH_NONE)



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux