[2/7] net/mlx5: fix the error set in quota init

Message ID 20230630054841.432300-1-bingz@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: Raslan Darawsheh
Headers
Series [1/7] net/mlx5: fix the modify field check of tag |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-unit-testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-aarch-unit-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS

Commit Message

Bing Zhao June 30, 2023, 5:48 a.m. UTC
  When there was a failure in the quota initialization, only the
return value was set. The "rte_errno" and the "rte_flow_error"
were not set. The application may get a crash when trying to
access the "message" field.

Fixes: 15896eaf9d71 ("net/mlx5: support indirect quota create/query/modify")
Cc: getelson@nvidia.com

Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_hw.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
  

Patch

diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index b5137a822a..ba2f1f7c92 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -7789,8 +7789,11 @@  flow_hw_configure(struct rte_eth_dev *dev,
 	/* Initialize quotas */
 	if (port_attr->nb_quotas) {
 		ret = mlx5_flow_quota_init(dev, port_attr->nb_quotas);
-		if (ret)
+		if (ret) {
+			rte_flow_error_set(error, -ret, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
+					   "Failed to initialize quota.");
 			goto err;
+		}
 	}
 	/* Initialize meter library*/
 	if (port_attr->nb_meters || (host_priv && host_priv->hws_mpool))