Skip to content

Commit

Permalink
net/mlx5: Fix memory leak in IPsec RoCE creation
Browse files Browse the repository at this point in the history
During IPsec RoCE TX creation a struct for the flow group creation is
allocated, but never freed. Free that struct once it is no longer in use.

Fixes: 22551e7 ("net/mlx5: Configure IPsec steering for egress RoCEv2 traffic")
Signed-off-by: Patrisious Haddad <[email protected]>
Signed-off-by: Leon Romanovsky <[email protected]>
Link: https://lore.kernel.org/r/a69739482cca7176d3a466f87bbf5af1250b09bb.1677056384.git.leon@kernel.org
Signed-off-by: Paolo Abeni <[email protected]>
  • Loading branch information
PatrisiousHaddad authored and Paolo Abeni committed Feb 23, 2023
1 parent 44bd039 commit c749e3f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions drivers/net/ethernet/mellanox/mlx5/core/lib/ipsec_fs_roce.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ int mlx5_ipsec_fs_roce_tx_create(struct mlx5_core_dev *mdev,
if (IS_ERR(ft)) {
err = PTR_ERR(ft);
mlx5_core_err(mdev, "Fail to create RoCE IPsec tx ft err=%d\n", err);
return err;
goto free_in;
}

roce->ft = ft;
Expand All @@ -174,22 +174,25 @@ int mlx5_ipsec_fs_roce_tx_create(struct mlx5_core_dev *mdev,
if (IS_ERR(g)) {
err = PTR_ERR(g);
mlx5_core_err(mdev, "Fail to create RoCE IPsec tx group err=%d\n", err);
goto fail;
goto destroy_table;
}
roce->g = g;

err = ipsec_fs_roce_tx_rule_setup(mdev, roce, pol_ft);
if (err) {
mlx5_core_err(mdev, "Fail to create RoCE IPsec tx rules err=%d\n", err);
goto rule_fail;
goto destroy_group;
}

kvfree(in);
return 0;

rule_fail:
destroy_group:
mlx5_destroy_flow_group(roce->g);
fail:
destroy_table:
mlx5_destroy_flow_table(ft);
free_in:
kvfree(in);
return err;
}

Expand Down

0 comments on commit c749e3f

Please sign in to comment.