Skip to content

Commit df14ad1

Browse files
Moshe ShemeshSaeed Mahameed
authored andcommitted
net/mlx5: Fix memory leak in mlx5_events_init
Fix memory leak in mlx5_events_init(), in case create_single_thread_workqueue() fails, events struct should be freed. Fixes: 5d3c537 ("net/mlx5: Handle event of power detection in the PCIE slot") Signed-off-by: Moshe Shemesh <[email protected]> Reviewed-by: Tariq Toukan <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent a16b8e0 commit df14ad1

File tree

1 file changed

+3
-1
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core

1 file changed

+3
-1
lines changed

drivers/net/ethernet/mellanox/mlx5/core/events.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,10 @@ int mlx5_events_init(struct mlx5_core_dev *dev)
346346
events->dev = dev;
347347
dev->priv.events = events;
348348
events->wq = create_singlethread_workqueue("mlx5_events");
349-
if (!events->wq)
349+
if (!events->wq) {
350+
kfree(events);
350351
return -ENOMEM;
352+
}
351353
INIT_WORK(&events->pcie_core_work, mlx5_pcie_event);
352354

353355
return 0;

0 commit comments

Comments
 (0)