From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6DC3D42E70; Fri, 14 Jul 2023 14:41:13 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F3081406B8; Fri, 14 Jul 2023 14:41:12 +0200 (CEST) Received: from agw.arknetworks.am (agw.arknetworks.am [79.141.165.80]) by mails.dpdk.org (Postfix) with ESMTP id 8679140685; Fri, 14 Jul 2023 14:41:11 +0200 (CEST) Received: from localhost.localdomain (unknown [78.109.74.178]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by agw.arknetworks.am (Postfix) with ESMTPSA id B56FDE0922; Fri, 14 Jul 2023 16:41:10 +0400 (+04) From: Ivan Malov To: dev@dpdk.org Cc: Andrew Rybchenko , Ferruh Yigit , 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 Message-Id: <20230714124102.6546-1-ivan.malov@arknetworks.am> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- 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