Skip to content

Commit 81d4d72

Browse files
idoschdavem330
authored andcommitted
mlxsw: core: Add missing rollback in error path
Without this rollback, the thermal zone is still registered during the error path, whereas its private data is freed upon the destruction of the underlying bus device due to the use of devm_kzalloc(). This results in use after free. Fix this by calling mlxsw_thermal_fini() from the appropriate place in the error path. Fixes: a50c1e3 ("mlxsw: core: Implement thermal zone") Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 87259f1 commit 81d4d72

File tree

1 file changed

+1
-0
lines changed
  • drivers/net/ethernet/mellanox/mlxsw

1 file changed

+1
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,6 +1157,7 @@ int mlxsw_core_bus_device_register(const struct mlxsw_bus_info *mlxsw_bus_info,
11571157
if (mlxsw_core->driver->fini)
11581158
mlxsw_core->driver->fini(mlxsw_core);
11591159
err_driver_init:
1160+
mlxsw_thermal_fini(mlxsw_core->thermal);
11601161
err_thermal_init:
11611162
err_hwmon_init:
11621163
devlink_unregister(devlink);

0 commit comments

Comments
 (0)