[PATCH v2 4/9] net/iavf: fix memory leak in raw pattern parsing

Anatoly Burakov anatoly.burakov at intel.com
Mon Oct 19 17:06:23 CEST 2026


From: Anurag Mandal <anurag.mandal at intel.com>

If mask buffer allocation fails in `iavf_hash_parse_raw_pattern()`,
the previously allocated packet buffer is leaked.

Free the packet buffer before returning the allocation error.

Fixes: bc0e85586eaf ("net/iavf: support VF RSS flow rule with raw pattern")
Cc: stable at dpdk.org

Signed-off-by: Anurag Mandal <anurag.mandal at intel.com>
Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
---

Notes:
    The API was removed in 92ef4b8f1688 ("ethdev: remove deprecated shared counter attribute")
    
    However, it may not be reasonable to pin a Fixline on that commit because that
    would imply that it *should have* updated ice driver's plubmbing to not support
    shared counters any more, which I do not believe is reasonable. I'm leaving
    this note for posterity and in case it is determined that the Fixline is needed
    after all.

 drivers/net/intel/iavf/iavf_hash.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/intel/iavf/iavf_hash.c b/drivers/net/intel/iavf/iavf_hash.c
index 9515094402..a240c73614 100644
--- a/drivers/net/intel/iavf/iavf_hash.c
+++ b/drivers/net/intel/iavf/iavf_hash.c
@@ -918,8 +918,10 @@ iavf_hash_parse_raw_pattern(const struct rte_flow_item *item,
 		return -ENOMEM;
 
 	msk_buf = rte_zmalloc(NULL, pkt_len, 0);
-	if (!msk_buf)
+	if (!msk_buf) {
+		rte_free(pkt_buf);
 		return -ENOMEM;
+	}
 
 	/* convert string to int array */
 	for (i = 0, j = 0; i < spec_len; i += 2, j++) {
-- 
2.52.0



More information about the dev mailing list