All of lore.kernel.org
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeed@kernel.org>
To: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Eric Dumazet <edumazet@google.com>
Cc: Saeed Mahameed <saeedm@nvidia.com>,
	netdev@vger.kernel.org, Tariq Toukan <tariqt@nvidia.com>,
	Vlad Buslov <vladbu@nvidia.com>
Subject: [net 01/15] Revert "net/mlx5e: fix double free of encap_header in update funcs"
Date: Wed, 13 Dec 2023 17:24:51 -0800	[thread overview]
Message-ID: <20231214012505.42666-2-saeed@kernel.org> (raw)
In-Reply-To: <20231214012505.42666-1-saeed@kernel.org>

From: Vlad Buslov <vladbu@nvidia.com>

This reverts commit 3a4aa3cb83563df942be49d145ee3b7ddf17d6bb.

This patch is causing a null ptr issue, the proper fix is in the next
patch.

Fixes: 3a4aa3cb8356 ("net/mlx5e: fix double free of encap_header in update funcs")
Signed-off-by: Vlad Buslov <vladbu@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 .../ethernet/mellanox/mlx5/core/en/tc_tun.c   | 20 +++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c
index 668da5c70e63..8bca696b6658 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c
@@ -403,12 +403,16 @@ int mlx5e_tc_tun_update_header_ipv4(struct mlx5e_priv *priv,
 	if (err)
 		goto free_encap;
 
+	e->encap_size = ipv4_encap_size;
+	kfree(e->encap_header);
+	e->encap_header = encap_header;
+
 	if (!(nud_state & NUD_VALID)) {
 		neigh_event_send(attr.n, NULL);
 		/* the encap entry will be made valid on neigh update event
 		 * and not used before that.
 		 */
-		goto free_encap;
+		goto release_neigh;
 	}
 
 	memset(&reformat_params, 0, sizeof(reformat_params));
@@ -422,10 +426,6 @@ int mlx5e_tc_tun_update_header_ipv4(struct mlx5e_priv *priv,
 		goto free_encap;
 	}
 
-	e->encap_size = ipv4_encap_size;
-	kfree(e->encap_header);
-	e->encap_header = encap_header;
-
 	e->flags |= MLX5_ENCAP_ENTRY_VALID;
 	mlx5e_rep_queue_neigh_stats_work(netdev_priv(attr.out_dev));
 	mlx5e_route_lookup_ipv4_put(&attr);
@@ -669,12 +669,16 @@ int mlx5e_tc_tun_update_header_ipv6(struct mlx5e_priv *priv,
 	if (err)
 		goto free_encap;
 
+	e->encap_size = ipv6_encap_size;
+	kfree(e->encap_header);
+	e->encap_header = encap_header;
+
 	if (!(nud_state & NUD_VALID)) {
 		neigh_event_send(attr.n, NULL);
 		/* the encap entry will be made valid on neigh update event
 		 * and not used before that.
 		 */
-		goto free_encap;
+		goto release_neigh;
 	}
 
 	memset(&reformat_params, 0, sizeof(reformat_params));
@@ -688,10 +692,6 @@ int mlx5e_tc_tun_update_header_ipv6(struct mlx5e_priv *priv,
 		goto free_encap;
 	}
 
-	e->encap_size = ipv6_encap_size;
-	kfree(e->encap_header);
-	e->encap_header = encap_header;
-
 	e->flags |= MLX5_ENCAP_ENTRY_VALID;
 	mlx5e_rep_queue_neigh_stats_work(netdev_priv(attr.out_dev));
 	mlx5e_route_lookup_ipv6_put(&attr);
-- 
2.43.0


  reply	other threads:[~2023-12-14  1:25 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-14  1:24 [pull request][net 00/15] mlx5 fixes 2023-12-13 Saeed Mahameed
2023-12-14  1:24 ` Saeed Mahameed [this message]
2023-12-15  3:10   ` [net 01/15] Revert "net/mlx5e: fix double free of encap_header in update funcs" patchwork-bot+netdevbpf
2023-12-14  1:24 ` [net 02/15] Revert "net/mlx5e: fix double free of encap_header" Saeed Mahameed
2023-12-14  1:24 ` [net 03/15] net/mlx5e: fix double free of encap_header Saeed Mahameed
2023-12-14  1:24 ` [net 04/15] net/mlx5e: Fix slab-out-of-bounds in mlx5_query_nic_vport_mac_list() Saeed Mahameed
2023-12-14  1:24 ` [net 05/15] net/mlx5e: Fix a race in command alloc flow Saeed Mahameed
2023-12-14  1:24 ` [net 06/15] net/mlx5e: fix a potential double-free in fs_udp_create_groups Saeed Mahameed
2023-12-14  1:24 ` [net 07/15] net/mlx5e: Fix overrun reported by coverity Saeed Mahameed
2023-12-14  1:24 ` [net 08/15] net/mlx5e: Decrease num_block_tc when unblock tc offload Saeed Mahameed
2023-12-14  1:24 ` [net 09/15] net/mlx5e: XDP, Drop fragmented packets larger than MTU size Saeed Mahameed
2023-12-14  1:25 ` [net 10/15] net/mlx5: Fix fw tracer first block check Saeed Mahameed
2023-12-14  1:25 ` [net 11/15] net/mlx5: Refactor mlx5_flow_destination->rep pointer to vport num Saeed Mahameed
2023-12-14  1:25 ` [net 12/15] net/mlx5e: Fix error code in mlx5e_tc_action_miss_mapping_get() Saeed Mahameed
2023-12-14  1:25 ` [net 13/15] net/mlx5e: Fix error codes in alloc_branch_attr() Saeed Mahameed
2023-12-14  1:25 ` [net 14/15] net/mlx5e: Correct snprintf truncation handling for fw_version buffer Saeed Mahameed
2023-12-14  1:25 ` [net 15/15] net/mlx5e: Correct snprintf truncation handling for fw_version buffer used by representors Saeed Mahameed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231214012505.42666-2-saeed@kernel.org \
    --to=saeed@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@nvidia.com \
    --cc=vladbu@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.