aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
diff options
context:
space:
mode:
authorEli Britstein <elibr@mellanox.com>2019-05-12 11:50:58 +0000
committerSaeed Mahameed <saeedm@mellanox.com>2019-05-17 13:16:49 -0700
commite7739a60712a041516f74c8917a0b3e5f1e4f01e (patch)
treeffd7189b3ba8370c8fc647bc2605ea4d1457b815 /drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
parentnet/mlx5e: Fix no rewrite fields with the same match (diff)
downloadlinux-dev-e7739a60712a041516f74c8917a0b3e5f1e4f01e.tar.xz
linux-dev-e7739a60712a041516f74c8917a0b3e5f1e4f01e.zip
net/mlx5e: Fix possible modify header actions memory leak
The cited commit could disable the modify header flag, but did not free the allocated memory for the modify header actions. Fix it. Fixes: 27c11b6b844cd ("net/mlx5e: Do not rewrite fields with the same match") Signed-off-by: Eli Britstein <elibr@mellanox.com> Reviewed-by: Roi Dayan <roid@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Diffstat (limited to '')
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_tc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 4722ac70f0a9..31cd02f11499 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -2567,8 +2567,10 @@ static int parse_tc_nic_actions(struct mlx5e_priv *priv,
/* in case all pedit actions are skipped, remove the MOD_HDR
* flag.
*/
- if (parse_attr->num_mod_hdr_actions == 0)
+ if (parse_attr->num_mod_hdr_actions == 0) {
action &= ~MLX5_FLOW_CONTEXT_ACTION_MOD_HDR;
+ kfree(parse_attr->mod_hdr_actions);
+ }
}
attr->action = action;
@@ -3005,6 +3007,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv,
*/
if (parse_attr->num_mod_hdr_actions == 0) {
action &= ~MLX5_FLOW_CONTEXT_ACTION_MOD_HDR;
+ kfree(parse_attr->mod_hdr_actions);
if (!((action & MLX5_FLOW_CONTEXT_ACTION_VLAN_POP) ||
(action & MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH)))
attr->split_count = 0;