Skip to content

Commit 4f98cb0

Browse files
vadimp-nvidiakuba-moo
authored andcommitted
mlxsw: minimal: Fix deadlock in ports creation
Drop devl_lock() / devl_unlock() from ports creation and removal flows since the devlink instance lock is now taken by mlxsw_core. Fixes: 72a4c8c ("mlxsw: convert driver to use unlocked devlink API during init/fini") Signed-off-by: Vadim Pasternak <[email protected]> Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: Petr Machata <[email protected]> Reviewed-by: Jiri Pirko <[email protected]> Link: https://lore.kernel.org/r/f4afce5ab0318617f3866b85274be52542d59b32.1660211614.git.petrm@nvidia.com Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 4f5d33f commit 4f98cb0

File tree

1 file changed

+0
-7
lines changed

1 file changed

+0
-7
lines changed

drivers/net/ethernet/mellanox/mlxsw/minimal.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,6 @@ static void mlxsw_m_port_module_unmap(struct mlxsw_m *mlxsw_m, u8 module)
328328
static int mlxsw_m_ports_create(struct mlxsw_m *mlxsw_m)
329329
{
330330
unsigned int max_ports = mlxsw_core_max_ports(mlxsw_m->core);
331-
struct devlink *devlink = priv_to_devlink(mlxsw_m->core);
332331
u8 last_module = max_ports;
333332
int i;
334333
int err;
@@ -357,7 +356,6 @@ static int mlxsw_m_ports_create(struct mlxsw_m *mlxsw_m)
357356
}
358357

359358
/* Create port objects for each valid entry */
360-
devl_lock(devlink);
361359
for (i = 0; i < mlxsw_m->max_ports; i++) {
362360
if (mlxsw_m->module_to_port[i] > 0) {
363361
err = mlxsw_m_port_create(mlxsw_m,
@@ -367,7 +365,6 @@ static int mlxsw_m_ports_create(struct mlxsw_m *mlxsw_m)
367365
goto err_module_to_port_create;
368366
}
369367
}
370-
devl_unlock(devlink);
371368

372369
return 0;
373370

@@ -377,7 +374,6 @@ static int mlxsw_m_ports_create(struct mlxsw_m *mlxsw_m)
377374
mlxsw_m_port_remove(mlxsw_m,
378375
mlxsw_m->module_to_port[i]);
379376
}
380-
devl_unlock(devlink);
381377
i = max_ports;
382378
err_module_to_port_map:
383379
for (i--; i > 0; i--)
@@ -390,18 +386,15 @@ static int mlxsw_m_ports_create(struct mlxsw_m *mlxsw_m)
390386

391387
static void mlxsw_m_ports_remove(struct mlxsw_m *mlxsw_m)
392388
{
393-
struct devlink *devlink = priv_to_devlink(mlxsw_m->core);
394389
int i;
395390

396-
devl_lock(devlink);
397391
for (i = 0; i < mlxsw_m->max_ports; i++) {
398392
if (mlxsw_m->module_to_port[i] > 0) {
399393
mlxsw_m_port_remove(mlxsw_m,
400394
mlxsw_m->module_to_port[i]);
401395
mlxsw_m_port_module_unmap(mlxsw_m, i);
402396
}
403397
}
404-
devl_unlock(devlink);
405398

406399
kfree(mlxsw_m->module_to_port);
407400
kfree(mlxsw_m->ports);

0 commit comments

Comments
 (0)