Commit 04f8c12f authored by Vlad Buslov's avatar Vlad Buslov Committed by Saeed Mahameed

net/mlx5: Bridge, take rtnl lock in init error handler

The mlx5_esw_bridge_cleanup() is expected to be called with rtnl lock
taken, which is true for mlx5e_rep_bridge_cleanup() function but not for
error handling code in mlx5e_rep_bridge_init(). Add missing rtnl
lock/unlock calls and extend both mlx5_esw_bridge_cleanup() and its dual
function mlx5_esw_bridge_init() with ASSERT_RTNL() to verify the invariant
from now on.

Fixes: 7cd6a54a ("net/mlx5: Bridge, handle FDB events")
Fixes: 19e9bfa0 ("net/mlx5: Bridge, add offload infrastructure")
Signed-off-by: default avatarVlad Buslov <vladbu@nvidia.com>
Reviewed-by: default avatarRoi Dayan <roid@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent c7108979
...@@ -509,7 +509,9 @@ void mlx5e_rep_bridge_init(struct mlx5e_priv *priv) ...@@ -509,7 +509,9 @@ void mlx5e_rep_bridge_init(struct mlx5e_priv *priv)
err_register_swdev: err_register_swdev:
destroy_workqueue(br_offloads->wq); destroy_workqueue(br_offloads->wq);
err_alloc_wq: err_alloc_wq:
rtnl_lock();
mlx5_esw_bridge_cleanup(esw); mlx5_esw_bridge_cleanup(esw);
rtnl_unlock();
} }
void mlx5e_rep_bridge_cleanup(struct mlx5e_priv *priv) void mlx5e_rep_bridge_cleanup(struct mlx5e_priv *priv)
......
...@@ -1574,6 +1574,8 @@ struct mlx5_esw_bridge_offloads *mlx5_esw_bridge_init(struct mlx5_eswitch *esw) ...@@ -1574,6 +1574,8 @@ struct mlx5_esw_bridge_offloads *mlx5_esw_bridge_init(struct mlx5_eswitch *esw)
{ {
struct mlx5_esw_bridge_offloads *br_offloads; struct mlx5_esw_bridge_offloads *br_offloads;
ASSERT_RTNL();
br_offloads = kvzalloc(sizeof(*br_offloads), GFP_KERNEL); br_offloads = kvzalloc(sizeof(*br_offloads), GFP_KERNEL);
if (!br_offloads) if (!br_offloads)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
...@@ -1590,6 +1592,8 @@ void mlx5_esw_bridge_cleanup(struct mlx5_eswitch *esw) ...@@ -1590,6 +1592,8 @@ void mlx5_esw_bridge_cleanup(struct mlx5_eswitch *esw)
{ {
struct mlx5_esw_bridge_offloads *br_offloads = esw->br_offloads; struct mlx5_esw_bridge_offloads *br_offloads = esw->br_offloads;
ASSERT_RTNL();
if (!br_offloads) if (!br_offloads)
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment