diff mbox series

[net,01/15] Revert "net/mlx5e: fix double free of encap_header in update funcs"

Message ID 20231214012505.42666-2-saeed@kernel.org (mailing list archive)
State Accepted
Commit 66ca8d4deca09bce3fc7bcf8ea7997fa1a51c33c
Delegated to: Netdev Maintainers
Headers show
Series [net,01/15] Revert "net/mlx5e: fix double free of encap_header in update funcs" | expand

Checks

Context Check Description
netdev/series_format success Pull request is its own cover letter
netdev/tree_selection success Clearly marked for net
netdev/ynl success SINGLE THREAD; Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1115 this patch: 1115
netdev/cc_maintainers success CCed 4 of 4 maintainers
netdev/build_clang success Errors and warnings before: 1142 this patch: 1142
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 1142 this patch: 1142
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 54 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Saeed Mahameed Dec. 14, 2023, 1:24 a.m. UTC
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(-)

Comments

patchwork-bot+netdevbpf@kernel.org Dec. 15, 2023, 3:10 a.m. UTC | #1
Hello:

This series was applied to netdev/net.git (main)
by Saeed Mahameed <saeedm@nvidia.com>:

On Wed, 13 Dec 2023 17:24:51 -0800 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - [net,01/15] Revert "net/mlx5e: fix double free of encap_header in update funcs"
    https://git.kernel.org/netdev/net/c/66ca8d4deca0
  - [net,02/15] Revert "net/mlx5e: fix double free of encap_header"
    https://git.kernel.org/netdev/net/c/5d089684dc43
  - [net,03/15] net/mlx5e: fix double free of encap_header
    https://git.kernel.org/netdev/net/c/8e13cd737cb4
  - [net,04/15] net/mlx5e: Fix slab-out-of-bounds in mlx5_query_nic_vport_mac_list()
    https://git.kernel.org/netdev/net/c/ddb38ddff9c7
  - [net,05/15] net/mlx5e: Fix a race in command alloc flow
    https://git.kernel.org/netdev/net/c/8f5100da56b3
  - [net,06/15] net/mlx5e: fix a potential double-free in fs_udp_create_groups
    https://git.kernel.org/netdev/net/c/e75efc6466ae
  - [net,07/15] net/mlx5e: Fix overrun reported by coverity
    https://git.kernel.org/netdev/net/c/da75fa542873
  - [net,08/15] net/mlx5e: Decrease num_block_tc when unblock tc offload
    https://git.kernel.org/netdev/net/c/be86106fd74a
  - [net,09/15] net/mlx5e: XDP, Drop fragmented packets larger than MTU size
    https://git.kernel.org/netdev/net/c/bcaf109f7947
  - [net,10/15] net/mlx5: Fix fw tracer first block check
    https://git.kernel.org/netdev/net/c/4261edf11cb7
  - [net,11/15] net/mlx5: Refactor mlx5_flow_destination->rep pointer to vport num
    https://git.kernel.org/netdev/net/c/04ad04e4fdd1
  - [net,12/15] net/mlx5e: Fix error code in mlx5e_tc_action_miss_mapping_get()
    https://git.kernel.org/netdev/net/c/86d5922679f3
  - [net,13/15] net/mlx5e: Fix error codes in alloc_branch_attr()
    https://git.kernel.org/netdev/net/c/d792e5f7f19b
  - [net,14/15] net/mlx5e: Correct snprintf truncation handling for fw_version buffer
    https://git.kernel.org/netdev/net/c/ad436b9c1270
  - [net,15/15] net/mlx5e: Correct snprintf truncation handling for fw_version buffer used by representors
    https://git.kernel.org/netdev/net/c/b13559b76157

You are awesome, thank you!
diff mbox series

Patch

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);