mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 04:10:18 +09:00
net/mlx5: Fix memory leak in mlx5_events_init
[ Upstream commitdf14ad1ecc] Fix memory leak in mlx5_events_init(), in case create_single_thread_workqueue() fails, events struct should be freed. Fixes:5d3c537f90("net/mlx5: Handle event of power detection in the PCIE slot") Signed-off-by: Moshe Shemesh <moshe@mellanox.com> Reviewed-by: Tariq Toukan <tariqt@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
e23f88f7e7
commit
02c97e8385
@@ -346,8 +346,10 @@ int mlx5_events_init(struct mlx5_core_dev *dev)
|
||||
events->dev = dev;
|
||||
dev->priv.events = events;
|
||||
events->wq = create_singlethread_workqueue("mlx5_events");
|
||||
if (!events->wq)
|
||||
if (!events->wq) {
|
||||
kfree(events);
|
||||
return -ENOMEM;
|
||||
}
|
||||
INIT_WORK(&events->pcie_core_work, mlx5_pcie_event);
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user