Skip to content

Commit 1d5928a

Browse files
Aleksandr MishinNipaLocal
authored andcommitted
mlxsw: core_linecards: Fix double memory deallocation in case of invalid INI file
In case of invalid INI file mlxsw_linecard_types_init() deallocates memory but doesn't reset pointer to NULL and returns 0. In case of any error occured after mlxsw_linecard_types_init() call, mlxsw_linecards_init() calls mlxsw_linecard_types_fini() which perform memory deallocation again. Add pointer reset to NULL. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: b217127 ("mlxsw: core_linecards: Add line card objects and implement provisioning") Signed-off-by: Aleksandr Mishin <amishin@t-argos.ru> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com> Signed-off-by: NipaLocal <nipa@local>
1 parent 08ab02b commit 1d5928a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1484,6 +1484,7 @@ static int mlxsw_linecard_types_init(struct mlxsw_core *mlxsw_core,
14841484
vfree(types_info->data);
14851485
err_data_alloc:
14861486
kfree(types_info);
1487+
linecards->types_info = NULL;
14871488
return err;
14881489
}
14891490

0 commit comments

Comments
 (0)