]> git.baikalelectronics.ru Git - kernel.git/commit
net/mlx5: Serialize module cleanup with reload and remove
authorShay Drory <shayd@nvidia.com>
Wed, 14 Dec 2022 20:16:23 +0000 (22:16 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Feb 2023 18:11:47 +0000 (19:11 +0100)
commit77cdf6a99db3d05281d58e4e06dec67efed097c1
tree8ba6cbfb0090004dc8d066d8d36d61c9bebe6725
parentf1b528a39bd016495c6c723bffdb80a93a0fb227
net/mlx5: Serialize module cleanup with reload and remove

[ Upstream commit ed9c62c36cda00ebadd8f4b83af53433b414521f ]

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: ed19ffd18395 ("net/mlx5e: Connect ethernet part to auxiliary bus")
Signed-off-by: Shay Drory <shayd@nvidia.com>
Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/main.c