From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id EE0E5A058A; Fri, 17 Apr 2020 09:30:50 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C3CD01DCFC; Fri, 17 Apr 2020 09:30:49 +0200 (CEST) Received: from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130]) by dpdk.org (Postfix) with ESMTP id 387691DCF8 for ; Fri, 17 Apr 2020 09:30:48 +0200 (CEST) From: Bing Zhao To: orika@mellanox.com, viacheslavo@mellanox.com, rasland@mellanox.com Cc: matan@mellanox.com, dev@dpdk.org Date: Fri, 17 Apr 2020 15:30:44 +0800 Message-Id: <1587108644-456343-1-git-send-email-bingz@mellanox.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-dev] [PATCH] net/mlx5: fix the empty flow error structure X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The output flow error parameter is used to indicate the detailed reason of the failure when calling a rte_flow_* interface. Even though sometimes the application will not check it or use it, the PMD must fill it in the failure branch before returning. Or else, some dirty value in the stack, heap will be accessed as a pointer and then cause a crash. In this case, when a port is stopped, it is not allowed to insert a flow from application. The detailed error information should be filled. If the application needs to check the detailed error reason, it will get the information but not result in any crash. Fixes: 6ec024870715 ("net/mlx5: check device stat before creating flow") Signed-off-by: Bing Zhao Acked-by: Ori Kam --- drivers/net/mlx5/mlx5_flow.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index c529aa3..6a5522c 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -4490,9 +4490,12 @@ struct rte_flow * * are not affected. */ if (unlikely(!dev->data->dev_started)) { - rte_errno = ENODEV; DRV_LOG(DEBUG, "port %u is not started when " "inserting a flow", dev->data->port_id); + rte_flow_error_set(error, ENODEV, + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, + NULL, + "port not started"); return NULL; } return (void *)(uintptr_t)flow_list_create(dev, &priv->flows, -- 1.8.3.1