From patchwork Wed Nov 18 17:00:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Baum X-Patchwork-Id: 84336 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B4E08A04DD; Wed, 18 Nov 2020 18:02:21 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 61147C920; Wed, 18 Nov 2020 18:00:36 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 87C8FC8B0 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 0AIH0IwW005874; Wed, 18 Nov 2020 19:00:18 +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:05 +0000 Message-Id: <1605718811-18652-1-git-send-email-michaelba@nvidia.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-dev] [PATCH 1/7] regex/mlx5: fix jump to the wrong label 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 mlx5_regex_pci_probe function allocates a mlx5_regex_priv structure using rte_zmalloc. If the allocation fails, the function jumps to the dev_error label in order to release previously allocated resources in the function. However, in the dev_error label it attempts to refer to the internal fields of the priv structure and if its allocation fails (as in this case) it is actually dereferencing to NULL. Replace the jump with an error label. Fixes: 1db6ebd4ef58 ("regex/mlx5: fix crash on initialization failure") Cc: stable@dpdk.org Signed-off-by: Michael Baum Acked-by: Ori Kam --- drivers/regex/mlx5/mlx5_regex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regex/mlx5/mlx5_regex.c b/drivers/regex/mlx5/mlx5_regex.c index 05048e7..c91c444 100644 --- a/drivers/regex/mlx5/mlx5_regex.c +++ b/drivers/regex/mlx5/mlx5_regex.c @@ -157,7 +157,7 @@ if (!priv) { DRV_LOG(ERR, "Failed to allocate private memory."); rte_errno = ENOMEM; - goto error; + goto dev_error; } priv->ctx = ctx; priv->nb_engines = 2; /* attr.regexp_num_of_engines */