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 9F686A053E; Mon, 27 Jul 2020 19:48:39 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1830B1C0CA; Mon, 27 Jul 2020 19:47:58 +0200 (CEST) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140081.outbound.protection.outlook.com [40.107.14.81]) by dpdk.org (Postfix) with ESMTP id 0C9C71C0BD for ; Mon, 27 Jul 2020 19:47:54 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XJlOVVWR5yUv0tsKlFzo+OgUHbuELrEbXrSf/7KXt7iPpEViWEKMRiAvYTKqpvoo1lGQCYhOI73w1B+AfBo32Og7yVeIlH8SjwvMciPDokRmgm/yZ3iWuR0yot4JDFgbh0CxkZVzCLCEUXtvo37nxPCeCmEvRIylai3wrY621GfIXjojSPu6b6mBknIsm44h8UqzJ6sYKpnI9i8dvJQTKAjBtzOitlGbP+oRJrZ5wLlcA1iAILU6Owq3511oiVPwjpXCSbInri+851xJQz01g/YJXNS218huoRz9OLRm2Xozw7ndbwPtGThBcXJmNUnel2Qpry54WQFlgduRhsIZMg== 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=ALlZR/tf6XFGlxjyc+gRf8pnhRSKlInI4Sp/BisdU5M5NJFfbXO9ludsdvRcrS0VUF5EgVBqYY3BnIVIU5l/ooAHD/I9+BFupTiOSdf828G2tFyctLc1ixz1UG3gdDn+VOIB9P4bdxk7iLiFHWK6lhoEwfiWP7DySy8iNePLtTrkDiHkMLzHm3SEwJYEOTym8SmmG+L/ss5xqJGu4jov4hPW6aAWM9c+tmZU7g4XzA/1xoEMpGkWGgDtgySDjKcFNJSTJ7IyGmIQXbQqQcgn0KcZcvBKLwFfnvZJX8Gwz8T6Y3Wyp85rWR8nGOT1OxFVK+99T8ZgCmoqF/r40irijQ== 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=HJhKqx7cF/JaXRBWM34oBu8MY4QC433KmEIW645geI0tYvjqSnxN0UHUgK2MD1nDzuNeqKdknPmuVDXNLvv8Til8sGj4aBDuNk8aUoZJclRobSMNl7eiffcsFEp8AykAhbN06iBE0fTZHvHesOaec58gAlXh94zDAgSw1QX3v4s= 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 AM0PR05MB6227.eurprd05.prod.outlook.com (2603:10a6:208:10f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.23; Mon, 27 Jul 2020 17:47:52 +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.033; Mon, 27 Jul 2020 17:47:52 +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: Mon, 27 Jul 2020 20:47:10 +0300 Message-Id: <20200727174715.330117-6-parav@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200727174715.330117-1-parav@mellanox.com> References: <20200610171728.89-2-parav@mellanox.com> <20200727174715.330117-1-parav@mellanox.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: DM5PR15CA0049.namprd15.prod.outlook.com (2603:10b6:3:ae::11) 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 DM5PR15CA0049.namprd15.prod.outlook.com (2603:10b6:3:ae::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.20 via Frontend Transport; Mon, 27 Jul 2020 17:47:51 +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: 8b70c398-f671-40a9-8133-08d832552fab X-MS-TrafficTypeDiagnostic: AM0PR05MB6227: 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: 0Slp4MJF+eI8gxB99dDDri39dkDxadbrvbROC54PPVfWIG6S7D4c2siQLRPrEK/Quh82gQ32tJJqghnPluhPHSz96o/zlV0GCjmOhzVpiiuRBUIZeRZn/CTa2cxJPlqLlXLAxfv06nPPlaBkJTummTsZgNcAF7CoP8wd5EfauUZvfDH1Us4clh7anofIyOzKouv2YaaIwizBJC40tsykv8lj6IYIwCa2VwmwnA+lSicb2QjaHG7EP4A1Y6rp7NPX9sMhYLtrDOxAo5u2O1B4+HIWYC6FjBOImKYUwrGX8j6a2PJgxdschXiURXxDChTDFhWNUjCJlsi7Au1LED+FNw== 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)(376002)(136003)(366004)(396003)(39860400002)(346002)(52116002)(6506007)(2906002)(316002)(6486002)(1076003)(5660300002)(8936002)(8676002)(478600001)(6666004)(6512007)(26005)(16526019)(186003)(66946007)(66556008)(66476007)(86362001)(2616005)(956004)(107886003)(4326008)(83380400001)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 7D+AtCLr4CCyXG4uvvBB1Mq7k6/oHL6cJTIJzkRheXjUPE5p3WBDjOM8C7bzEOOtcNnGjOWA1ENFThJXulkOd/iNQPh7/gz+JJt7M8xt3TrF4OVFksiFYc2KnsUV5u98jN+sCNkb6Mt5NEd+gJIH+GC1qHWrCJlnX1HJ+8QCJetTIgLqabH5YFxB59qACBsJ+TCkFqrAZaDtKV2418mDuktAeY+BOV9gSeH2/gXNSkzes7aB9Zb08duLXWYLbyWJHnb7j2MGspD3Lt0f4/9VvlDnc2K8uCPVpkc+58Q8efaDzNgxNSUgbnabacn6ViBwO+pkccSOq7TLm41ad0dLe/9vXFBvYus5jPMAt9kkwsdwTkOAWN0XuzHAEGm9hlUOqQYJ4XYlJ2zNTqLkKcTt4UfTOQoT0ja/qrbaqY+GeCOXpvb+t7Ztg/V+Q5d7RClMF66BKDVZs4M/n2//UXTGRgjlcD4ttO40ocsgO10HpgBENdR7CYZjDyVr6ZehEZTq X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8b70c398-f671-40a9-8133-08d832552fab X-MS-Exchange-CrossTenant-AuthSource: AM0PR05MB4866.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2020 17:47:52.7962 (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: FksYOeKAxM2VnqTrXykvEDRib3CI6sG5QEFS3W7cO66yX5jb9i4FyZTp2X7WKfRRemWcFTDVHQKxBlOCIXM2+w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB6227 Subject: [dpdk-dev] [PATCH v12 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