[dpdk-stable] patch 'net/cxgbe: fix CLIP leak in filter error path' has been queued to stable release 19.11.4

luca.boccassi at gmail.com luca.boccassi at gmail.com
Fri Jul 24 13:57:57 CEST 2020


Hi,

FYI, your patch has been queued to stable release 19.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 07/26/20. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Thanks.

Luca Boccassi

---
>From 3c1368a539cc4353188cb73bdb1dbcba0d654b47 Mon Sep 17 00:00:00 2001
From: Rahul Lakkireddy <rahul.lakkireddy at chelsio.com>
Date: Sat, 13 Jun 2020 03:37:23 +0530
Subject: [PATCH] net/cxgbe: fix CLIP leak in filter error path

[ upstream commit 844b21299f1a10ac350528365dc761e2934512ee ]

Free up Compressed Local IP (CLIP) entry properly during filter
creation failure path. Also consolidate all various tables
cleanup to a common function and invoke it from both wild-card
and exact-match filter paths.

Fixes: af44a577988b ("net/cxgbe: support to offload flows to HASH region")

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy at chelsio.com>
---
 drivers/net/cxgbe/cxgbe_filter.c | 68 +++++++++++++++-----------------
 1 file changed, 31 insertions(+), 37 deletions(-)

diff --git a/drivers/net/cxgbe/cxgbe_filter.c b/drivers/net/cxgbe/cxgbe_filter.c
index b9d9d5d39..8a8031cb9 100644
--- a/drivers/net/cxgbe/cxgbe_filter.c
+++ b/drivers/net/cxgbe/cxgbe_filter.c
@@ -269,6 +269,22 @@ int cxgbe_alloc_ftid(struct adapter *adap, u8 nentries)
 	return pos < size ? pos : -1;
 }
 
+/**
+ * Clear a filter and release any of its resources that we own.  This also
+ * clears the filter's "pending" status.
+ */
+static void clear_filter(struct filter_entry *f)
+{
+	if (f->clipt)
+		cxgbe_clip_release(f->dev, f->clipt);
+
+	/* The zeroing of the filter rule below clears the filter valid,
+	 * pending, locked flags etc. so it's all we need for
+	 * this operation.
+	 */
+	memset(f, 0, sizeof(*f));
+}
+
 /**
  * Construct hash filter ntuple.
  */
@@ -555,7 +571,7 @@ static int cxgbe_set_hash_filter(struct rte_eth_dev *dev,
 
 	f = t4_os_alloc(sizeof(*f));
 	if (!f)
-		goto out_err;
+		return -ENOMEM;
 
 	f->fs = *fs;
 	f->ctx = ctx;
@@ -592,7 +608,7 @@ static int cxgbe_set_hash_filter(struct rte_eth_dev *dev,
 		mbuf = rte_pktmbuf_alloc(ctrlq->mb_pool);
 		if (!mbuf) {
 			ret = -ENOMEM;
-			goto free_clip;
+			goto free_atid;
 		}
 
 		mbuf->data_len = size;
@@ -622,33 +638,15 @@ static int cxgbe_set_hash_filter(struct rte_eth_dev *dev,
 	t4_mgmt_tx(ctrlq, mbuf);
 	return 0;
 
-free_clip:
-	cxgbe_clip_release(f->dev, f->clipt);
 free_atid:
 	cxgbe_free_atid(t, atid);
 
 out_err:
+	clear_filter(f);
 	t4_os_free(f);
 	return ret;
 }
 
-/**
- * Clear a filter and release any of its resources that we own.  This also
- * clears the filter's "pending" status.
- */
-static void clear_filter(struct filter_entry *f)
-{
-	if (f->clipt)
-		cxgbe_clip_release(f->dev, f->clipt);
-
-	/*
-	 * The zeroing of the filter rule below clears the filter valid,
-	 * pending, locked flags etc. so it's all we need for
-	 * this operation.
-	 */
-	memset(f, 0, sizeof(*f));
-}
-
 /**
  * t4_mk_filtdelwr - create a delete filter WR
  * @adap: adapter context
@@ -1007,16 +1005,6 @@ int cxgbe_set_filter(struct rte_eth_dev *dev, unsigned int filter_id,
 		return ret;
 	}
 
-	/*
-	 * Allocate a clip table entry only if we have non-zero IPv6 address
-	 */
-	if (chip_ver > CHELSIO_T5 && fs->type &&
-	    memcmp(fs->val.lip, bitoff, sizeof(bitoff))) {
-		f->clipt = cxgbe_clip_alloc(dev, (u32 *)&fs->val.lip);
-		if (!f->clipt)
-			goto free_tid;
-	}
-
 	/*
 	 * Convert the filter specification into our internal format.
 	 * We copy the PF/VF specification into the Outer VLAN field
@@ -1027,6 +1015,16 @@ int cxgbe_set_filter(struct rte_eth_dev *dev, unsigned int filter_id,
 	f->fs.iq = iq;
 	f->dev = dev;
 
+	/* Allocate a clip table entry only if we have non-zero IPv6 address. */
+	if (chip_ver > CHELSIO_T5 && f->fs.type &&
+	    memcmp(f->fs.val.lip, bitoff, sizeof(bitoff))) {
+		f->clipt = cxgbe_clip_alloc(dev, (u32 *)&f->fs.val.lip);
+		if (!f->clipt) {
+			ret = -ENOMEM;
+			goto free_tid;
+		}
+	}
+
 	/*
 	 * Attempt to set the filter.  If we don't succeed, we clear
 	 * it and return the failure.
@@ -1107,6 +1105,7 @@ void cxgbe_hash_filter_rpl(struct adapter *adap,
 		}
 
 		cxgbe_free_atid(t, ftid);
+		clear_filter(f);
 		t4_os_free(f);
 	}
 
@@ -1331,13 +1330,8 @@ void cxgbe_hash_del_filter_rpl(struct adapter *adap,
 	}
 
 	ctx = f->ctx;
-	f->ctx = NULL;
-
-	f->valid = 0;
-
-	if (f->clipt)
-		cxgbe_clip_release(f->dev, f->clipt);
 
+	clear_filter(f);
 	cxgbe_remove_tid(t, 0, tid, 0);
 	t4_os_free(f);
 
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-07-24 12:53:50.121429259 +0100
+++ 0039-net-cxgbe-fix-CLIP-leak-in-filter-error-path.patch	2020-07-24 12:53:48.251005789 +0100
@@ -1,15 +1,16 @@
-From 844b21299f1a10ac350528365dc761e2934512ee Mon Sep 17 00:00:00 2001
+From 3c1368a539cc4353188cb73bdb1dbcba0d654b47 Mon Sep 17 00:00:00 2001
 From: Rahul Lakkireddy <rahul.lakkireddy at chelsio.com>
 Date: Sat, 13 Jun 2020 03:37:23 +0530
 Subject: [PATCH] net/cxgbe: fix CLIP leak in filter error path
 
+[ upstream commit 844b21299f1a10ac350528365dc761e2934512ee ]
+
 Free up Compressed Local IP (CLIP) entry properly during filter
 creation failure path. Also consolidate all various tables
 cleanup to a common function and invoke it from both wild-card
 and exact-match filter paths.
 
 Fixes: af44a577988b ("net/cxgbe: support to offload flows to HASH region")
-Cc: stable at dpdk.org
 
 Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy at chelsio.com>
 ---
@@ -17,10 +18,10 @@
  1 file changed, 31 insertions(+), 37 deletions(-)
 
 diff --git a/drivers/net/cxgbe/cxgbe_filter.c b/drivers/net/cxgbe/cxgbe_filter.c
-index 27e96c73e..45602d468 100644
+index b9d9d5d39..8a8031cb9 100644
 --- a/drivers/net/cxgbe/cxgbe_filter.c
 +++ b/drivers/net/cxgbe/cxgbe_filter.c
-@@ -284,6 +284,22 @@ int cxgbe_alloc_ftid(struct adapter *adap, u8 nentries)
+@@ -269,6 +269,22 @@ int cxgbe_alloc_ftid(struct adapter *adap, u8 nentries)
  	return pos < size ? pos : -1;
  }
  
@@ -43,7 +44,7 @@
  /**
   * Construct hash filter ntuple.
   */
-@@ -583,7 +599,7 @@ static int cxgbe_set_hash_filter(struct rte_eth_dev *dev,
+@@ -555,7 +571,7 @@ static int cxgbe_set_hash_filter(struct rte_eth_dev *dev,
  
  	f = t4_os_alloc(sizeof(*f));
  	if (!f)
@@ -52,7 +53,7 @@
  
  	f->fs = *fs;
  	f->ctx = ctx;
-@@ -631,7 +647,7 @@ static int cxgbe_set_hash_filter(struct rte_eth_dev *dev,
+@@ -592,7 +608,7 @@ static int cxgbe_set_hash_filter(struct rte_eth_dev *dev,
  		mbuf = rte_pktmbuf_alloc(ctrlq->mb_pool);
  		if (!mbuf) {
  			ret = -ENOMEM;
@@ -61,7 +62,7 @@
  		}
  
  		mbuf->data_len = size;
-@@ -661,33 +677,15 @@ static int cxgbe_set_hash_filter(struct rte_eth_dev *dev,
+@@ -622,33 +638,15 @@ static int cxgbe_set_hash_filter(struct rte_eth_dev *dev,
  	t4_mgmt_tx(ctrlq, mbuf);
  	return 0;
  
@@ -96,7 +97,7 @@
  /**
   * t4_mk_filtdelwr - create a delete filter WR
   * @adap: adapter context
-@@ -1070,16 +1068,6 @@ int cxgbe_set_filter(struct rte_eth_dev *dev, unsigned int filter_id,
+@@ -1007,16 +1005,6 @@ int cxgbe_set_filter(struct rte_eth_dev *dev, unsigned int filter_id,
  		return ret;
  	}
  
@@ -113,7 +114,7 @@
  	/*
  	 * Convert the filter specification into our internal format.
  	 * We copy the PF/VF specification into the Outer VLAN field
-@@ -1090,6 +1078,16 @@ int cxgbe_set_filter(struct rte_eth_dev *dev, unsigned int filter_id,
+@@ -1027,6 +1015,16 @@ int cxgbe_set_filter(struct rte_eth_dev *dev, unsigned int filter_id,
  	f->fs.iq = iq;
  	f->dev = dev;
  
@@ -127,10 +128,10 @@
 +		}
 +	}
 +
- 	iconf = adapter->params.tp.ingress_config;
- 
- 	/* Either PFVF or OVLAN can be active, but not both
-@@ -1192,6 +1190,7 @@ void cxgbe_hash_filter_rpl(struct adapter *adap,
+ 	/*
+ 	 * Attempt to set the filter.  If we don't succeed, we clear
+ 	 * it and return the failure.
+@@ -1107,6 +1105,7 @@ void cxgbe_hash_filter_rpl(struct adapter *adap,
  		}
  
  		cxgbe_free_atid(t, ftid);
@@ -138,7 +139,7 @@
  		t4_os_free(f);
  	}
  
-@@ -1416,13 +1415,8 @@ void cxgbe_hash_del_filter_rpl(struct adapter *adap,
+@@ -1331,13 +1330,8 @@ void cxgbe_hash_del_filter_rpl(struct adapter *adap,
  	}
  
  	ctx = f->ctx;


More information about the stable mailing list