Commit c749e3f8 authored by Patrisious Haddad's avatar Patrisious Haddad Committed by Paolo Abeni

net/mlx5: Fix memory leak in IPsec RoCE creation

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: 22551e77 ("net/mlx5: Configure IPsec steering for egress RoCEv2 traffic")
Signed-off-by: default avatarPatrisious Haddad <phaddad@nvidia.com>
Signed-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
Link: https://lore.kernel.org/r/a69739482cca7176d3a466f87bbf5af1250b09bb.1677056384.git.leon@kernel.orgSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 44bd0394
...@@ -162,7 +162,7 @@ int mlx5_ipsec_fs_roce_tx_create(struct mlx5_core_dev *mdev, ...@@ -162,7 +162,7 @@ int mlx5_ipsec_fs_roce_tx_create(struct mlx5_core_dev *mdev,
if (IS_ERR(ft)) { if (IS_ERR(ft)) {
err = PTR_ERR(ft); err = PTR_ERR(ft);
mlx5_core_err(mdev, "Fail to create RoCE IPsec tx ft err=%d\n", err); mlx5_core_err(mdev, "Fail to create RoCE IPsec tx ft err=%d\n", err);
return err; goto free_in;
} }
roce->ft = ft; roce->ft = ft;
...@@ -174,22 +174,25 @@ int mlx5_ipsec_fs_roce_tx_create(struct mlx5_core_dev *mdev, ...@@ -174,22 +174,25 @@ int mlx5_ipsec_fs_roce_tx_create(struct mlx5_core_dev *mdev,
if (IS_ERR(g)) { if (IS_ERR(g)) {
err = PTR_ERR(g); err = PTR_ERR(g);
mlx5_core_err(mdev, "Fail to create RoCE IPsec tx group err=%d\n", err); mlx5_core_err(mdev, "Fail to create RoCE IPsec tx group err=%d\n", err);
goto fail; goto destroy_table;
} }
roce->g = g; roce->g = g;
err = ipsec_fs_roce_tx_rule_setup(mdev, roce, pol_ft); err = ipsec_fs_roce_tx_rule_setup(mdev, roce, pol_ft);
if (err) { if (err) {
mlx5_core_err(mdev, "Fail to create RoCE IPsec tx rules err=%d\n", 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; return 0;
rule_fail: destroy_group:
mlx5_destroy_flow_group(roce->g); mlx5_destroy_flow_group(roce->g);
fail: destroy_table:
mlx5_destroy_flow_table(ft); mlx5_destroy_flow_table(ft);
free_in:
kvfree(in);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment