Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 May 2019 11:08:01 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r347321 - head/sys/dev/mlx5/mlx5_en
Message-ID:  <201905081108.x48B81rI064004@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Wed May  8 11:08:01 2019
New Revision: 347321
URL: https://svnweb.freebsd.org/changeset/base/347321

Log:
  Undo previous steps upon returning failure in mlx5en(4).
  
  Else flowtable resources may not be properly freed.
  
  MFC after:	3 days
  Sponsored by:	Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c	Wed May  8 11:07:42 2019	(r347320)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c	Wed May  8 11:08:01 2019	(r347321)
@@ -633,7 +633,11 @@ mlx5e_add_any_vid_rules(struct mlx5e_priv *priv)
 	if (err)
 		return (err);
 
-	return (mlx5e_add_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_ANY_STAG_VID, 0));
+	err = mlx5e_add_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_ANY_STAG_VID, 0);
+	if (err)
+		mlx5e_del_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_ANY_CTAG_VID, 0);
+
+	return (err);
 }
 
 void
@@ -701,19 +705,22 @@ mlx5e_add_all_vlan_rules(struct mlx5e_priv *priv)
 		err = mlx5e_add_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_MATCH_VID,
 					  i);
 		if (err)
-			return (err);
+			goto error;
 	}
 
 	err = mlx5e_add_vlan_rule(priv, MLX5E_VLAN_RULE_TYPE_UNTAGGED, 0);
 	if (err)
-		return (err);
+		goto error;
 
 	if (priv->vlan.filter_disabled) {
 		err = mlx5e_add_any_vid_rules(priv);
 		if (err)
-			return (err);
+			goto error;
 	}
 	return (0);
+error:
+	mlx5e_del_all_vlan_rules(priv);
+	return (err);
 }
 
 void



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201905081108.x48B81rI064004>