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 9D1BFA04DD for ; Wed, 18 Nov 2020 18:00:41 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C5A29C90E; Wed, 18 Nov 2020 18:00:34 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 71D475937 for ; Wed, 18 Nov 2020 18:00:25 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from michaelba@nvidia.com) with SMTP; 18 Nov 2020 19:00:19 +0200 Received: from nvidia.com (pegasus07.mtr.labs.mlnx [10.210.16.112]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 0AIH0IwZ005874; Wed, 18 Nov 2020 19:00:19 +0200 From: Michael Baum To: dev@dpdk.org Cc: Matan Azrad , Raslan Darawsheh , Viacheslav Ovsiienko , stable@dpdk.org Date: Wed, 18 Nov 2020 17:00:08 +0000 Message-Id: <1605718811-18652-4-git-send-email-michaelba@nvidia.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1605718811-18652-1-git-send-email-michaelba@nvidia.com> References: <1605718811-18652-1-git-send-email-michaelba@nvidia.com> Subject: [dpdk-stable] [PATCH 4/7] regex/mlx5: fix unchecked return value in RXP handle X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" The rxp_flush_rules function tries to read and write to the register several times using DevX API, and when it fails the function returns an error. Similarly the rxp_init_eng function also tries to write to the register several times, and if writing is failed, it returns an error too. Both functions have one write that the function does not check if it succeeded, overriding the return value from the write function without using it. Add a check for this writing, and return an error in case of failure. Fixes: b34d816363b5 ("regex/mlx5: support rules import") Fixes: e3dbbf718ebc ("regex/mlx5: support configuration") Cc: stable@dpdk.org Signed-off-by: Michael Baum Acked-by: Ori Kam --- drivers/regex/mlx5/mlx5_rxp.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/regex/mlx5/mlx5_rxp.c b/drivers/regex/mlx5/mlx5_rxp.c index 41fbae7..ba78cc0 100644 --- a/drivers/regex/mlx5/mlx5_rxp.c +++ b/drivers/regex/mlx5/mlx5_rxp.c @@ -194,6 +194,10 @@ val |= MLX5_RXP_RTRU_CSR_CTRL_GO; ret = mlx5_devx_regex_register_write(ctx, id, MLX5_RXP_RTRU_CSR_CTRL, val); + if (ret) { + DRV_LOG(ERR, "CSR write failed!"); + return -1; + } ret = rxp_poll_csr_for_value(ctx, &val, MLX5_RXP_RTRU_CSR_STATUS, MLX5_RXP_RTRU_CSR_STATUS_UPDATE_DONE, MLX5_RXP_RTRU_CSR_STATUS_UPDATE_DONE, @@ -554,6 +558,8 @@ return ret; ctrl &= ~MLX5_RXP_CSR_CTRL_INIT; ret = mlx5_devx_regex_register_write(ctx, id, MLX5_RXP_CSR_CTRL, ctrl); + if (ret) + return ret; rte_delay_us(20000); ret = rxp_poll_csr_for_value(ctx, &ctrl, MLX5_RXP_CSR_STATUS, MLX5_RXP_CSR_STATUS_INIT_DONE, -- 1.8.3.1