diff options
author | Moshe Shemesh <moshe@mellanox.com> | 2020-04-29 23:56:58 +0300 |
---|---|---|
committer | Saeed Mahameed <saeedm@mellanox.com> | 2020-05-22 17:28:46 -0700 |
commit | df14ad1eccb04a4a28c90389214dbacab085b244 (patch) | |
tree | 89c396e75f1b1352ff8be3e1217cb3506f176ddc /drivers/net/ethernet | |
parent | a16b8e0dcf7043bee46174bed0553cc9e36b63a5 (diff) | |
download | linux-df14ad1eccb04a4a28c90389214dbacab085b244.tar.bz2 |
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: 5d3c537f9070 ("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>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/events.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/events.c b/drivers/net/ethernet/mellanox/mlx5/core/events.c index 8bcf3426b9c6..3ce17c3d7a00 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/events.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/events.c @@ -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; |