DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Alexey Simakov <bigalex934@gmail.com>
To: John Daley <johndale@cisco.com>, Hyong Youb Kim <hyonkim@cisco.com>
Cc: dev@dpdk.org, stable@dpdk.org, Alexey Simakov <bigalex934@gmail.com>
Subject: [PATCH] net/enic: fix null dereference in flow query count
Date: Tue,  7 Jul 2026 14:44:36 +0300	[thread overview]
Message-ID: <20260707114437.94425-1-bigalex934@gmail.com> (raw)

begin_fm() can return NULL when the flow manager is not initialized.
enic_fm_flow_query_count() did not check the return value, leading
to a NULL pointer dereference on flowman_cmd() and end_fm().

Add NULL check that returns -ENOTSUP with a descriptive error
message via rte_flow_error_set().

Fixes: ea7768b5bba8 ("net/enic: add flow implementation based on Flow Manager API")
Cc: stable@dpdk.org

Signed-off-by: Alexey Simakov <bigalex934@gmail.com>
---
 drivers/net/enic/enic_fm_flow.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/enic/enic_fm_flow.c b/drivers/net/enic/enic_fm_flow.c
index 4b0a513977..28e2a9c1e4 100644
--- a/drivers/net/enic/enic_fm_flow.c
+++ b/drivers/net/enic/enic_fm_flow.c
@@ -2904,6 +2904,13 @@ enic_fm_flow_query_count(struct rte_eth_dev *dev,
 
 	ENICPMD_FUNC_TRACE();
 	fm = begin_fm(pmd_priv(dev));
+
+	if (!fm) {
+		return rte_flow_error_set(error, ENOTSUP,
+			RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
+			"enic: flowman is not initialized");
+	}
+
 	query = data;
 	fm_flow = flow->fm;
 	if (!fm_flow->counter_valid) {
-- 
2.34.1


             reply	other threads:[~2026-07-07 11:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-07 11:44 Alexey Simakov [this message]
2026-07-09  9:11 ` [PATCH] net/enic: fix null dereference in flow query count Hyong Youb Kim (hyonkim)

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=20260707114437.94425-1-bigalex934@gmail.com \
    --to=bigalex934@gmail.com \
    --cc=dev@dpdk.org \
    --cc=hyonkim@cisco.com \
    --cc=johndale@cisco.com \
    --cc=stable@dpdk.org \
    /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