DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Anatoly Burakov <anatoly.burakov@intel.com>
To: dev@dpdk.org, Vladimir Medvedkin <vladimir.medvedkin@intel.com>,
	Abhijit Sinha <abhijit.sinha@intel.com>,
	Jingjing Wu <jingjing.wu@intel.com>,
	Radu Nicolau <radu.nicolau@intel.com>,
	Declan Doherty <declan.doherty@intel.com>
Subject: [PATCH v3 10/10] net/iavf: fix IPsec flow metadata leaks
Date: Tue, 20 Oct 2026 10:11:33 +0100	[thread overview]
Message-ID: <604dfd252f6979b9cdeb205175e5891b6e9fd665.1792487374.git.anatoly.burakov@intel.com> (raw)
In-Reply-To: <cover.1792487374.git.anatoly.burakov@intel.com> <cover.1792487374.git.anatoly.burakov@intel.com>

IPsec flow parsing leaves the pattern-match item allocated after
extracting its metadata. It also leaves the parsed flow item allocated
when no metadata output is requested.

Free the pattern-match item after parsing and free the parsed flow item
when it cannot be returned to the caller. Propagate pattern-match failure
and report a parsing error when no flow item was produced.

Fixes: 6bc987ecb860 ("net/iavf: support IPsec inline crypto")
Cc: stable@dpdk.org

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 drivers/net/intel/iavf/iavf_ipsec_crypto.c | 28 +++++++++++++++-------
 1 file changed, 20 insertions(+), 8 deletions(-)

diff --git a/drivers/net/intel/iavf/iavf_ipsec_crypto.c b/drivers/net/intel/iavf/iavf_ipsec_crypto.c
index f7e391a74a..be0a0d0df6 100644
--- a/drivers/net/intel/iavf/iavf_ipsec_crypto.c
+++ b/drivers/net/intel/iavf/iavf_ipsec_crypto.c
@@ -1942,6 +1942,7 @@ iavf_ipsec_flow_parse(struct iavf_adapter *ad,
 		.max_actions = 1,
 	};
 	struct iavf_pattern_match_item *item = NULL;
+	struct iavf_ipsec_flow_item *fi = NULL;
 	int ret = -1;
 
 	ret = ci_flow_check_attr(attr, NULL, error);
@@ -1953,17 +1954,28 @@ iavf_ipsec_flow_parse(struct iavf_adapter *ad,
 		return ret;
 
 	item = iavf_search_pattern_match_item(pattern, array, array_len, error);
-	if (item && item->meta) {
+	if (item == NULL)
+		return -rte_errno;
+
+	if (item->meta != NULL) {
 		const struct rte_security_session *session = parsed_actions.actions[0]->conf;
 		uint32_t type = (uint64_t)(item->meta);
-		struct iavf_ipsec_flow_item *fi =
-				iavf_ipsec_flow_item_parse(ad, pattern, session, type);
-		if (fi && meta) {
-			*meta = fi;
-			ret = 0;
-		}
+
+		fi = iavf_ipsec_flow_item_parse(ad, pattern, session, type);
 	}
-	return ret;
+	rte_free(item);
+
+	if (fi == NULL)
+		return rte_flow_error_set(error, EINVAL,
+				RTE_FLOW_ERROR_TYPE_ACTION, NULL,
+				"Invalid IPsec flow.");
+
+	if (meta != NULL)
+		*meta = fi;
+	else
+		rte_free(fi);
+
+	return 0;
 }
 
 /*
-- 
2.52.0


  parent reply	other threads:[~2026-10-20  9:12 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14 15:18 [PATCH v1 0/7] IAVF Fixes Anatoly Burakov
2026-10-14 15:18 ` [PATCH v1 1/7] net/iavf: fix memory leak in flow teardown Anatoly Burakov
2026-10-14 15:18 ` [PATCH v1 2/7] net/iavf: fix null engine for egress security flows Anatoly Burakov
2026-10-14 15:18 ` [PATCH v1 3/7] net/iavf: fix generic flow error-path leaks Anatoly Burakov
2026-10-14 15:18 ` [PATCH v1 4/7] net/iavf: fix flow subscription metadata leaks Anatoly Burakov
2026-10-14 15:18 ` [PATCH v1 5/7] net/iavf: fix hash flow " Anatoly Burakov
2026-10-16  3:12   ` Mandal, Anurag
2026-10-16 11:00     ` Burakov, Anatoly
2026-10-14 15:18 ` [PATCH v1 6/7] net/iavf: fix IPsec " Anatoly Burakov
2026-10-14 15:18 ` [PATCH v1 7/7] net/iavf: do not store ethdev pointer Anatoly Burakov
2026-10-19 15:06 ` [PATCH v2 0/9] IAVF Fixes Anatoly Burakov
2026-10-19 15:06   ` [PATCH v2 1/9] net/iavf: keep device stopped if start fails Anatoly Burakov
2026-10-19 15:06   ` [PATCH v2 2/9] net/iavf: do not store ethdev pointer Anatoly Burakov
2026-10-19 15:06   ` [PATCH v2 3/9] net/iavf: fix false success on flow validation Anatoly Burakov
2026-10-19 15:06   ` [PATCH v2 4/9] net/iavf: fix memory leak in raw pattern parsing Anatoly Burakov
2026-10-19 15:13     ` Burakov, Anatoly
2026-10-19 15:06   ` [PATCH v2 5/9] net/iavf: fix memory leaks around IRQ resources Anatoly Burakov
2026-10-19 15:06   ` [PATCH v2 6/9] net/iavf: fix generic flow error-path leaks Anatoly Burakov
2026-10-19 15:06   ` [PATCH v2 7/9] net/iavf: centralize memory management for flows Anatoly Burakov
2026-10-19 15:06   ` [PATCH v2 8/9] net/iavf: fix null engine for egress security flows Anatoly Burakov
2026-10-19 15:06   ` [PATCH v2 9/9] net/iavf: fix IPsec flow metadata leaks Anatoly Burakov
2026-10-20  9:11 ` [PATCH v3 00/10] IAVF Fixes Anatoly Burakov
2026-10-20  9:11   ` [PATCH v3 01/10] net/iavf: keep device stopped if start fails Anatoly Burakov
2026-10-20  9:11   ` [PATCH v3 02/10] net/iavf: do not store ethdev pointer Anatoly Burakov
2026-10-20  9:11   ` [PATCH v3 03/10] net/iavf: fix false success on flow validation Anatoly Burakov
2026-10-20  9:11   ` [PATCH v3 04/10] net/iavf: fix memory leaks around IRQ resources Anatoly Burakov
2026-10-20  9:11   ` [PATCH v3 05/10] net/iavf: fix generic flow error-path leaks Anatoly Burakov
2026-10-20  9:11   ` [PATCH v3 06/10] net/iavf: centralize memory management for flows Anatoly Burakov
2026-10-20  9:11   ` [PATCH v3 07/10] net/iavf: skip RSS teardown during PF-initiated reset Anatoly Burakov
2026-10-20  9:11   ` [PATCH v3 08/10] net/iavf: remove redundant reset checks from RSS engine Anatoly Burakov
2026-10-20  9:11   ` [PATCH v3 09/10] net/iavf: fix null engine for egress security flows Anatoly Burakov
2026-10-20  9:35     ` Radu Nicolau
2026-10-20  9:11   ` Anatoly Burakov [this message]
2026-10-20  9:36     ` [PATCH v3 10/10] net/iavf: fix IPsec flow metadata leaks Radu Nicolau
2026-10-21 14:25 ` [PATCH v4 00/10] IAVF Fixes Anatoly Burakov
2026-10-21 14:25   ` [PATCH v4 01/10] net/iavf: keep device stopped if start fails Anatoly Burakov
2026-10-22 12:57     ` Bruce Richardson
2026-10-21 14:25   ` [PATCH v4 02/10] net/iavf: do not store ethdev pointer Anatoly Burakov
2026-10-22 12:57     ` Bruce Richardson
2026-10-21 14:25   ` [PATCH v4 03/10] net/iavf: fix false success on flow validation Anatoly Burakov
2026-10-22 12:57     ` Bruce Richardson
2026-10-21 14:25   ` [PATCH v4 04/10] net/iavf: fix memory leaks around IRQ resources Anatoly Burakov
2026-10-22 13:08     ` Bruce Richardson
2026-10-21 14:25   ` [PATCH v4 05/10] net/iavf: fix generic flow error-path leaks Anatoly Burakov
2026-10-22 13:15     ` Bruce Richardson
2026-10-21 14:25   ` [PATCH v4 06/10] net/iavf: centralize memory management for flows Anatoly Burakov
2026-10-22 14:18     ` Bruce Richardson
2026-10-21 14:25   ` [PATCH v4 07/10] net/iavf: skip RSS teardown during PF-initiated reset Anatoly Burakov
2026-10-22 14:31     ` Bruce Richardson
2026-10-21 14:25   ` [PATCH v4 08/10] net/iavf: remove redundant reset checks from RSS engine Anatoly Burakov
2026-10-22 14:41     ` Bruce Richardson
2026-10-21 14:25   ` [PATCH v4 09/10] net/iavf: fix null engine for egress security flows Anatoly Burakov
2026-10-21 14:25   ` [PATCH v4 10/10] net/iavf: fix IPsec flow metadata leaks Anatoly Burakov
2026-10-23  9:32 ` [PATCH v5 00/10] IAVF Fixes Anatoly Burakov
2026-10-23  9:32   ` [PATCH v5 01/10] net/iavf: keep device stopped if start fails Anatoly Burakov
2026-10-23  9:32   ` [PATCH v5 02/10] net/iavf: do not store ethdev pointer Anatoly Burakov
2026-10-23  9:32   ` [PATCH v5 03/10] net/iavf: fix false success on flow validation Anatoly Burakov
2026-10-23  9:32   ` [PATCH v5 04/10] net/iavf: fix memory leaks around IRQ resources Anatoly Burakov
2026-10-23  9:37     ` Bruce Richardson
2026-10-23  9:32   ` [PATCH v5 05/10] net/iavf: fix generic flow error-path leaks Anatoly Burakov
2026-10-23  9:32   ` [PATCH v5 06/10] net/iavf: centralize memory management for flows Anatoly Burakov
2026-10-23  9:32   ` [PATCH v5 07/10] net/iavf: skip RSS teardown during PF-initiated reset Anatoly Burakov
2026-10-23  9:32   ` [PATCH v5 08/10] net/iavf: remove redundant reset checks from RSS engine Anatoly Burakov
2026-10-23  9:32   ` [PATCH v5 09/10] net/iavf: fix null engine for egress security flows Anatoly Burakov
2026-10-23  9:32   ` [PATCH v5 10/10] net/iavf: fix IPsec flow metadata leaks Anatoly Burakov
2026-10-23 10:26   ` [PATCH v5 00/10] IAVF Fixes Bruce Richardson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=604dfd252f6979b9cdeb205175e5891b6e9fd665.1792487374.git.anatoly.burakov@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=abhijit.sinha@intel.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=radu.nicolau@intel.com \
    --cc=vladimir.medvedkin@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox