git: 5c5bb958fc82 - main - mlx5: plug theoretical leak in vxlan rules

From: Eric van Gyzen <vangyzen_at_FreeBSD.org>
Date: Thu, 14 Aug 2025 01:47:29 UTC
The branch main has been updated by vangyzen:

URL: https://cgit.FreeBSD.org/src/commit/?id=5c5bb958fc823215cfb5a71c1ac7b6d9d93c0701

commit 5c5bb958fc823215cfb5a71c1ac7b6d9d93c0701
Author:     Eric van Gyzen <vangyzen@FreeBSD.org>
AuthorDate: 2025-08-12 14:51:38 +0000
Commit:     Eric van Gyzen <vangyzen@FreeBSD.org>
CommitDate: 2025-08-14 01:47:14 +0000

    mlx5: plug theoretical leak in vxlan rules
    
    Plug a theoretical memory/refcount leak when adding a vxlan rule.
    This is not currently an actual leak, but it could become one.
    
    PR:             287945
    Reviewed by:    kib
    Sponsored by:   Dell Inc.
    Differential Revision: https://reviews.freebsd.org/D51883
---
 sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c
index 6e24395b5577..c45f02cdaf42 100644
--- a/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c
+++ b/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c
@@ -1783,8 +1783,8 @@ mlx5e_add_vxlan_rule(struct mlx5e_priv *priv, sa_family_t family, u_int port)
 		el->refcount++;
 		if (el->installed)
 			return (0);
-	}
-	el = mlx5e_vxlan_alloc_db_el(priv, proto, port);
+	} else
+		el = mlx5e_vxlan_alloc_db_el(priv, proto, port);
 
 	if ((if_getcapenable(priv->ifp) & IFCAP_VXLAN_HWCSUM) != 0) {
 		err = mlx5e_add_vxlan_rule_from_db(priv, el);