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 888C4A0524; Sun, 26 Jul 2020 16:56:52 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E337F1C0D2; Sun, 26 Jul 2020 16:56:02 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2087.outbound.protection.outlook.com [40.107.21.87]) by dpdk.org (Postfix) with ESMTP id 0F83C1C0B2 for ; Sun, 26 Jul 2020 16:55:55 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D8Y++z7D6wQmQ89WOWpuiYrzjPwu62n+K+TsteQL4FwzWBKpxzdPluDfOilCWt21N0yClNuglzR1M3ycvub6nxw9aUPfLH2JqY60e4Hcydde3Y3DGnq3YAOa0SG3ra4WDqCYPOuPR35C/AB4QtEYX0E0QgNNadQ4rhHS7KVWgmbjO1a2LtOPBXLkiNFM0lOki7N83/VqpvhzdI1DGyrzFaYvdt7/gvMGBMQMB/DFPvWen7wkipeDhAinQiAGfssJj3nVHOB1A8mjWAcSRU1m+JEccchJCUtnsZKQPYCgwuD8F0hS5lw2kMVZZg6hq/owbB6KoL83TQf+Zo42DoX5jA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R5ekeH0puSZW7SLNupwWh4oCACuINI0zNj5viw7VciA=; b=gAvj08juFD+/Mksmh4iR1XxPzSrzNDcrf5zQ3DbpxyZvHB64tdFbzrzEm+0QYU0mlf/7UmoTSRKcNxTyI6gLUy06lyML/9Wngxb8wKbkEucuR4KCq4rZLR3sCPuBNva0aCkm0nIscX2YNceaiVpMjWJxf7Xyq9hWlfUiYgbqBBR4UkHY746uiU7t60CVEJCAEtXH9FQuL5ozOoaTrIb10BKoGD3RskXCCmvWrvkRlo2XZZ7I0RLaebyQ8BmRWjFyID9r8IG+iqAbZzsrIqx3RHmi+L+Ilpj3TfeC+IwkEqgl5c9K4f3bPmInYkC21QEEMXANY9StTGYw6tY2c+Z/Ww== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R5ekeH0puSZW7SLNupwWh4oCACuINI0zNj5viw7VciA=; b=S957Jx6QypKTUhP0tsDKSokawj7WTF8hZaTSMct24A05q2vJTh8PkGstK3eu8yw+++BVTR4sbgQ2hAbWx+J7FNNUp09srrClFgcVCZIzYv5qpXhCUo16vTJAUlbOxMGiuMcGSDZMtiIofFPIXUtfQ5i4il3yyAvTdh0HTCzQfsI= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=mellanox.com; Received: from AM0PR05MB4866.eurprd05.prod.outlook.com (2603:10a6:208:c0::32) by AM0PR05MB6225.eurprd05.prod.outlook.com (2603:10a6:208:117::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.27; Sun, 26 Jul 2020 14:55:54 +0000 Received: from AM0PR05MB4866.eurprd05.prod.outlook.com ([fe80::eccf:72b3:bacb:f09d]) by AM0PR05MB4866.eurprd05.prod.outlook.com ([fe80::eccf:72b3:bacb:f09d%5]) with mapi id 15.20.3216.031; Sun, 26 Jul 2020 14:55:54 +0000 From: Parav Pandit To: dev@dpdk.org, grive@u256.net, ferruh.yigit@intel.com, thomas@monjalon.net Cc: rasland@mellanox.com, orika@mellanox.com, matan@mellanox.com, joyce.kong@arm.com, Parav Pandit Date: Sun, 26 Jul 2020 17:55:19 +0300 Message-Id: <20200726145524.149355-6-parav@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200726145524.149355-1-parav@mellanox.com> References: <20200610171728.89-2-parav@mellanox.com> <20200726145524.149355-1-parav@mellanox.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: DM5PR04CA0045.namprd04.prod.outlook.com (2603:10b6:3:12b::31) To AM0PR05MB4866.eurprd05.prod.outlook.com (2603:10a6:208:c0::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sw-mtx-036.mtx.labs.mlnx (208.176.44.194) by DM5PR04CA0045.namprd04.prod.outlook.com (2603:10b6:3:12b::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.23 via Frontend Transport; Sun, 26 Jul 2020 14:55:52 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [208.176.44.194] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 04e9fb73-27a3-4907-fd05-08d83173febf X-MS-TrafficTypeDiagnostic: AM0PR05MB6225: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtFwd,ExtAddr X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:386; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nAELsSYBQZlbsHgxVabMbBrVx0pdnScVXfRcb7T2Wd3RA1KEkGs8SZ3SKTlzGmrKePezlD9ooyLrDj2M3Cqz/Be0r2ts3iKitX73ZT+u4e7O0OTOFh1vycnLWlT9eIR8qlGjStXKOL7oxlwGO22y463CPWeFNmK7J3aI4MRN+uwfYKXn45+3kGEqsRthP+tGUsp7D8t3tyUT3MPrhJ4JA+1wF5NcT8VnE2W0WlvU1NU2ExaxADpUNV4hYaWLyiQoeDojbysb80GfjBNmvocyT1tXD8+xQe8OxQMfMCUtGEg+oi2bv77Q4fOymenoELOeFo9NI647WzCn3NYihMS0lA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR05MB4866.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(366004)(396003)(346002)(39860400002)(136003)(376002)(6486002)(66476007)(8936002)(66556008)(6512007)(2616005)(956004)(186003)(66946007)(26005)(16526019)(8676002)(1076003)(6666004)(316002)(83380400001)(6506007)(107886003)(4326008)(36756003)(478600001)(2906002)(86362001)(52116002)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Ls84a0Dl8BLTZbv+G3R8dV2kZGDA+5peV29GBP50tJYgppLcLpVPsQkjzfCxjn5DUSE9FkToE++Qghf9nlRU8MGZR3V5Q6EcxfmkjglI2cfXKUuALHfXlHZEUu5QYDQXjP+VfnyfFlrzCz/71naVteOG2vRpkS4cj8gQwn4iAEFPs+5AMxTHvv3fSnIWOYvoeX/NrhzEBRFAMcpJsTuWyiJLpzIBFBjE45u2Ge2aGW8jI8AR5dCX2XdgLwLq0BtQ6h/y1ttAQeNjAIsfAI4A7GkiI8qwEVBHbPxL1IWrKMD38XWLNvTwQ2nB3Xq3V5/qQvqMIQuYJyTRU85D3vbI6uUg9CrAxuy9gmThwfdYF5M+ZcfTEAoFL71xNqpqdDfQ4nSdwud+JNm2hdHj0dkJtzHZSv3lST5HTaBgitn2nSiMleH7AXQk1yAmu4xyHFVHCPo37IlOwGMf3xF+Mz1EEb6v9BNUQL2Qppd0mVeE3WEl2oeWFf7IhhSsnHBxZidF X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 04e9fb73-27a3-4907-fd05-08d83173febf X-MS-Exchange-CrossTenant-AuthSource: AM0PR05MB4866.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jul 2020 14:55:53.9319 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Fix5mD/HqiLDuIZHdsCT2/KX3nHiSpaJydeEvoWmFytcn35D1i1lCxTc5HR5iktUKD5DZlXyzDeHxw+DbQrowQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB6225 Subject: [dpdk-dev] [PATCH v11 05/10] regex/mlx5: fix segmentation fault during error unwinding 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" When fail to initialize the device, avoid segmentation fault while accessing uninitialized priv. Fixes: cfc672a90b74 ("regex/mlx5: support probing") Signed-off-by: Parav Pandit --- Changelog: v9->v10: - Corrected type in commit log v7->v8: - Rebased - new patch --- drivers/regex/mlx5/mlx5_regex.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/regex/mlx5/mlx5_regex.c b/drivers/regex/mlx5/mlx5_regex.c index 1ca5bfe9b..36ae9f809 100644 --- a/drivers/regex/mlx5/mlx5_regex.c +++ b/drivers/regex/mlx5/mlx5_regex.c @@ -137,17 +137,17 @@ mlx5_regex_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, if (ret) { DRV_LOG(ERR, "Unable to read HCA capabilities."); rte_errno = ENOTSUP; - goto error; + goto dev_error; } else if (!attr.regex || attr.regexp_num_of_engines == 0) { DRV_LOG(ERR, "Not enough capabilities to support RegEx, maybe " "old FW/OFED version?"); rte_errno = ENOTSUP; - goto error; + goto dev_error; } if (mlx5_regex_engines_status(ctx, 2)) { DRV_LOG(ERR, "RegEx engine error."); rte_errno = ENOMEM; - goto error; + goto dev_error; } priv = rte_zmalloc("mlx5 regex device private", sizeof(*priv), RTE_CACHE_LINE_SIZE); @@ -200,6 +200,7 @@ mlx5_regex_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, mlx5_glue->devx_free_uar(priv->uar); if (priv->regexdev) rte_regexdev_unregister(priv->regexdev); +dev_error: if (ctx) mlx5_glue->close_device(ctx); if (priv) -- 2.26.2