diff mbox series

[net,1/9] net/mlx5e: Fix modify header actions memory leak

Message ID 20201103191830.60151-2-saeedm@nvidia.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net,1/9] net/mlx5e: Fix modify header actions memory leak | expand

Commit Message

Saeed Mahameed Nov. 3, 2020, 7:18 p.m. UTC
From: Maor Dickman <maord@nvidia.com>

Modify header actions are allocated during parse tc actions and only
freed during the flow creation, however, on error flow the allocated
memory is wrongly unfreed.

Fix this by calling dealloc_mod_hdr_actions in __mlx5e_add_fdb_flow
and mlx5e_add_nic_flow error flow.

Fixes: d7e75a325cb2 ("net/mlx5e: Add offloading of E-Switch TC pedit (header re-write) action"')
Fixes: 2f4fe4cab073 ("net/mlx5e: Add offloading of NIC TC pedit (header re-write) actions")
Signed-off-by: Maor Dickman <maord@nvidia.com>
Reviewed-by: Paul Blakey <paulb@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Jakub Kicinski Nov. 4, 2020, 10:03 p.m. UTC | #1
On Tue, 3 Nov 2020 11:18:22 -0800 Saeed Mahameed wrote:
> From: Maor Dickman <maord@nvidia.com>
> 
> Modify header actions are allocated during parse tc actions and only
> freed during the flow creation, however, on error flow the allocated
> memory is wrongly unfreed.
> 
> Fix this by calling dealloc_mod_hdr_actions in __mlx5e_add_fdb_flow
> and mlx5e_add_nic_flow error flow.
> 
> Fixes: d7e75a325cb2 ("net/mlx5e: Add offloading of E-Switch TC pedit (header re-write) action"')
> Fixes: 2f4fe4cab073 ("net/mlx5e: Add offloading of NIC TC pedit (header re-write) actions")
> Signed-off-by: Maor Dickman <maord@nvidia.com>
> Reviewed-by: Paul Blakey <paulb@nvidia.com>
> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>

Sorry, I didn't look at the warnings for you patches yesterday.

Fixes tag: Fixes: d7e75a325cb2 ("net/mlx5e: Add offloading of E-Switch TC pedit (header re-write) action"')
Has these problem(s):
	- Subject has leading but no trailing quotes
	- Subject does not match target commit subject
	  Just use
		git log -1 --format='Fixes: %h ("%s")'
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index e3a968e9e2a0..2e2fa0440032 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -4658,6 +4658,7 @@  __mlx5e_add_fdb_flow(struct mlx5e_priv *priv,
 	return flow;
 
 err_free:
+	dealloc_mod_hdr_actions(&parse_attr->mod_hdr_acts);
 	mlx5e_flow_put(priv, flow);
 out:
 	return ERR_PTR(err);
@@ -4802,6 +4803,7 @@  mlx5e_add_nic_flow(struct mlx5e_priv *priv,
 	return 0;
 
 err_free:
+	dealloc_mod_hdr_actions(&parse_attr->mod_hdr_acts);
 	mlx5e_flow_put(priv, flow);
 out:
 	return err;