Patch "net/mlx5: Serialize module cleanup with reload and remove" has been added to the 5.15-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

    net/mlx5: Serialize module cleanup with reload and remove

to the 5.15-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:
     net-mlx5-serialize-module-cleanup-with-reload-and-re.patch
and it can be found in the queue-5.15 subdirectory.

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



commit 67b96dcb0749836125edcb22871e7d97821e36aa
Author: Shay Drory <shayd@xxxxxxxxxx>
Date:   Wed Dec 14 22:16:23 2022 +0200

    net/mlx5: Serialize module cleanup with reload and remove
    
    [ Upstream commit 8f0d1451ecf7b3bd5a06ffc866c753d0f3ab4683 ]
    
    Currently, remove and reload flows can run in parallel to module cleanup.
    This design is error prone. For example: aux_drivers callbacks are called
    from both cleanup and remove flows with different lockings, which can
    cause a deadlock[1].
    Hence, serialize module cleanup with reload and remove.
    
    [1]
           cleanup                        remove
           -------                        ------
       auxiliary_driver_unregister();
                                         devl_lock()
                                          auxiliary_device_delete(mlx5e_aux)
        device_lock(mlx5e_aux)
         devl_lock()
                                           device_lock(mlx5e_aux)
    
    Fixes: 912cebf420c2 ("net/mlx5e: Connect ethernet part to auxiliary bus")
    Signed-off-by: Shay Drory <shayd@xxxxxxxxxx>
    Reviewed-by: Moshe Shemesh <moshe@xxxxxxxxxx>
    Signed-off-by: Saeed Mahameed <saeedm@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index 9e15eea9743fe..485a6a6220f6a 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -1862,7 +1862,7 @@ static int __init mlx5_init(void)
 	mlx5_fpga_ipsec_build_fs_cmds();
 	mlx5_register_debugfs();
 
-	err = pci_register_driver(&mlx5_core_driver);
+	err = mlx5e_init();
 	if (err)
 		goto err_debug;
 
@@ -1870,16 +1870,16 @@ static int __init mlx5_init(void)
 	if (err)
 		goto err_sf;
 
-	err = mlx5e_init();
+	err = pci_register_driver(&mlx5_core_driver);
 	if (err)
-		goto err_en;
+		goto err_pci;
 
 	return 0;
 
-err_en:
+err_pci:
 	mlx5_sf_driver_unregister();
 err_sf:
-	pci_unregister_driver(&mlx5_core_driver);
+	mlx5e_cleanup();
 err_debug:
 	mlx5_unregister_debugfs();
 	return err;
@@ -1887,9 +1887,9 @@ static int __init mlx5_init(void)
 
 static void __exit mlx5_cleanup(void)
 {
-	mlx5e_cleanup();
-	mlx5_sf_driver_unregister();
 	pci_unregister_driver(&mlx5_core_driver);
+	mlx5_sf_driver_unregister();
+	mlx5e_cleanup();
 	mlx5_unregister_debugfs();
 }
 



[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