patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH 1/1] net/sfc: add explicit fail path for unknown tunnel flow type
@ 2023-07-14 12:41 Ivan Malov
  2023-07-17  8:27 ` Andrew Rybchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Ivan Malov @ 2023-07-14 12:41 UTC (permalink / raw)
  To: dev; +Cc: Andrew Rybchenko, Ferruh Yigit, stable

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] net/sfc: add explicit fail path for unknown tunnel flow type
  2023-07-14 12:41 [PATCH 1/1] net/sfc: add explicit fail path for unknown tunnel flow type Ivan Malov
@ 2023-07-17  8:27 ` Andrew Rybchenko
  2023-07-17 14:12   ` Ferruh Yigit
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Rybchenko @ 2023-07-17  8:27 UTC (permalink / raw)
  To: Ivan Malov, dev; +Cc: Ferruh Yigit, stable

On 7/14/23 15:41, Ivan Malov wrote:
> 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>

Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] net/sfc: add explicit fail path for unknown tunnel flow type
  2023-07-17  8:27 ` Andrew Rybchenko
@ 2023-07-17 14:12   ` Ferruh Yigit
  0 siblings, 0 replies; 3+ messages in thread
From: Ferruh Yigit @ 2023-07-17 14:12 UTC (permalink / raw)
  To: Andrew Rybchenko, Ivan Malov; +Cc: stable, dev

On 7/17/2023 9:27 AM, Andrew Rybchenko wrote:
> On 7/14/23 15:41, Ivan Malov wrote:
>> 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>
> 
> Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> 

Applied to dpdk-next-net/main, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-17 14:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-14 12:41 [PATCH 1/1] net/sfc: add explicit fail path for unknown tunnel flow type Ivan Malov
2023-07-17  8:27 ` Andrew Rybchenko
2023-07-17 14:12   ` Ferruh Yigit

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).