All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] net/mlx5e: TC, Fix double free of branch in failure
@ 2026-10-28 14:57 Thomas Fourier
  2026-10-28 15:05 ` netdev-bot+sinfo
  2026-10-28 15:09 ` sashiko-bot
  0 siblings, 2 replies; 3+ messages in thread
From: Thomas Fourier @ 2026-10-28 14:57 UTC (permalink / raw)
  Cc: Thomas Fourier, Saeed Mahameed, Tariq Toukan, Mark Bloch,
	Leon Romanovsky, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Oz Shlomo, Roi Dayan,
	open list:MELLANOX ETHERNET DRIVER (mlx5e),
	open list:MELLANOX MLX5 core VPI driver, open list

When allocating the false branch fails in parse_branch_ctrl(), the
already allocated true branch is freed but attr->branch_true is left
pointing to it. The caller parse_tc_actions() fails the flow, and
free_flow_post_acts(), mlx5_free_flow_attr_actions() which calls again
free_branch_attr() on attr->branch_true.

Clear the pointer after freeing it.

This bug is theoretical and was compile tested only.

Fixes: f86488cb4685 ("net/mlx5e: TC, initialize branch flow attributes")
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index b290beb4369a..c40c7b55a54d 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -4005,6 +4005,7 @@ parse_branch_ctrl(struct flow_action_entry *act, struct mlx5e_tc_act *tc_act,
 
 err_branch_false:
 	free_branch_attr(flow, attr->branch_true);
+	attr->branch_true = NULL;
 out_err:
 	return err;
 }
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-28 15:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-28 14:57 [PATCH net] net/mlx5e: TC, Fix double free of branch in failure Thomas Fourier
2026-10-28 15:05 ` netdev-bot+sinfo
2026-10-28 15:09 ` sashiko-bot

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.