DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ivan Malov <ivan.malov@arknetworks.am>
To: dev@dpdk.org
Cc: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
	Ferruh Yigit <ferruh.yigit@amd.com>,
	stable@dpdk.org
Subject: [PATCH 1/1] net/sfc: add explicit fail path for unknown tunnel flow type
Date: Fri, 14 Jul 2023 16:41:02 +0400	[thread overview]
Message-ID: <20230714124102.6546-1-ivan.malov@arknetworks.am> (raw)

The driver supports flow tunnel offload. When the parsed rule
type is unknown, which must not happen, the driver does not
properly indicate the failure in non-debug builds. That
presumably makes Coverity report possible NULL pointer
dereference in regard with uninitialised HW match
specification (which gets properly initialised
when the rule type check is successful).

In order to fix this, replace the debug
assert with a proper runtime fail path.

Coverity issue: 393675
Fixes: 73e01736868b ("net/sfc: turn MAE flow action rules into shareable resources")
Cc: stable@dpdk.org

Signed-off-by: Ivan Malov <ivan.malov@arknetworks.am>
---
 drivers/net/sfc/sfc_mae.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c
index 60a54fd425..f5fe55b46f 100644
--- a/drivers/net/sfc/sfc_mae.c
+++ b/drivers/net/sfc/sfc_mae.c
@@ -3460,8 +3460,10 @@ sfc_mae_rule_parse_pattern(struct sfc_adapter *sa,
 		}
 		break;
 	default:
-		SFC_ASSERT(B_FALSE);
-		break;
+		rc = rte_flow_error_set(error, EINVAL,
+			RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
+			"FT: unexpected rule type");
+		goto fail_unexpected_ft_rule_type;
 	}
 
 	/*
@@ -3531,6 +3533,7 @@ sfc_mae_rule_parse_pattern(struct sfc_adapter *sa,
 	if (ctx_mae.match_spec_action != NULL)
 		efx_mae_match_spec_fini(sa->nic, ctx_mae.match_spec_action);
 
+fail_unexpected_ft_rule_type:
 fail_init_match_spec_action:
 fail_priority_check:
 	return rc;
-- 
2.17.1


             reply	other threads:[~2023-07-14 12:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-14 12:41 Ivan Malov [this message]
2023-07-17  8:27 ` Andrew Rybchenko
2023-07-17 14:12   ` Ferruh Yigit

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=20230714124102.6546-1-ivan.malov@arknetworks.am \
    --to=ivan.malov@arknetworks.am \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.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;
as well as URLs for NNTP newsgroup(s).