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 CFC09A0526; Fri, 24 Jul 2020 16:25:20 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4EEC21C0B5; Fri, 24 Jul 2020 16:24:38 +0200 (CEST) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20066.outbound.protection.outlook.com [40.107.2.66]) by dpdk.org (Postfix) with ESMTP id 217331C067 for ; Fri, 24 Jul 2020 16:24:35 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AMXePt0JHnqXXBAHpHnNKfhw51ShIPrqkqWl1kJAkun9mw3+bV8WcjiXkqvqpYMRJnfhARzXPIsnC0JKK1qcuZm5rlU8nAMWJYPj8BC72vY+YRtsM+nUXOmO7kSLZSKy7JlLBdKMqPzNO8Bjtlrmz5Vd18uaPk+ZdAmjR1owbxCgc88LOGMTKLWayYNvcTIoK4QP5GYXccEhUdDNClgqcda/+Wd4mO3tW+AA5lk3y6gzn0jeX1OqN+Kt06Tca3UnXfPRd7NIu9u4G3TH4g5kf+ZwiOus6b27Ok86UNGt3pcMZbYLH5zs6yQcgxX0eQ+JB3XeIaOjKv5cDERJ3bxRbw== 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=2zXOPzSDaqbYBJbLVYQKpBVLmAdEifVRatgI4tQUJAg=; b=QFZND6YvlvL4LOWT/Fal0bDnP+wi25yck4snrKjHom48hjtK8s1rpXJsfav8AzysvfXUS56+CS0Nf2zYsC+wX0YwSUSlUoLQWgA3jthv0KBiGpMLsKbcs+hd4dihGX7bw6JKEbr4DUrYIrzH2wKrMqKem0QSjXRp2acmrII6CyTrlFonYHrOjtlMO/2IIQnFadvwA//337olJlKOk8JndMpJqfpq7/yDf4AsaiIRn49Nv3GE6oULO7vLcxXzWoIyYC4tXqu0PkFUuwOxLf74rG2o4jult96fuLyM0PYa7zosOyisjLT5dSvUWQnXS0XX8HlWCXCCznh0UNV665LFGw== 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=2zXOPzSDaqbYBJbLVYQKpBVLmAdEifVRatgI4tQUJAg=; b=k5oZalQg9Ng7L6MB0zsYzfFEK6AEwC0LKxjzYxoZFUMT/MSN8d4/64J1vSL2O70In9krdQbyxHHE+qfw2YQztKVU6FB3Eq2+1A2m4qIGnzjWkZh/HW+EOVEskFFdBeYB1Mh4fZZ6NqyxozVUNd5CdEjrm240TKeoMkIMXjHeAtE= 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 AM4PR05MB3203.eurprd05.prod.outlook.com (2603:10a6:205:6::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.20; Fri, 24 Jul 2020 14:24:33 +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.024; Fri, 24 Jul 2020 14:24:33 +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: Fri, 24 Jul 2020 17:23:58 +0300 Message-Id: <20200724142403.6132-6-parav@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200724142403.6132-1-parav@mellanox.com> References: <20200610171728.89-2-parav@mellanox.com> <20200724142403.6132-1-parav@mellanox.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: DM6PR02CA0136.namprd02.prod.outlook.com (2603:10b6:5:1b4::38) 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 DM6PR02CA0136.namprd02.prod.outlook.com (2603:10b6:5:1b4::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.21 via Frontend Transport; Fri, 24 Jul 2020 14:24:32 +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: d3c8ca3c-9cc0-4ae0-a814-08d82fdd493c X-MS-TrafficTypeDiagnostic: AM4PR05MB3203: 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:1360; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: B5LRy8mMRbaUw/FLH1omwMhgnQJECBTLRq3zY7pifZF6Jy4rn30ahdzf0leZ7JjWHZrEfFF/n6XgOP536p3WJF99G6di8/uRfTXQnR/CdUmvTY9ZjblfpSyPRcTTjMNDx4oyS1ji9di1Kr4wCCY9xcAFklk42mlfE1OoToHhlicmLdjJLBO0kpQuAYxh4M5Dl2x8CnC4fOKbs97LJ0RsWnMbqxw5tc+fJ/hBTXIrfl0nwWjDZghXVwdxFOwC/zeSUccNiRgOCB+6RkeG9jeVMbHqichq5EcSQmnfVQrI/pvPnNCtKygWSNzQLP1cmsZ2aQPMu+3lNWhgEKaZ86Uipw== 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)(346002)(136003)(366004)(396003)(39860400002)(5660300002)(86362001)(2616005)(956004)(6512007)(2906002)(66946007)(66476007)(66556008)(316002)(6506007)(4326008)(16526019)(186003)(26005)(107886003)(8936002)(478600001)(8676002)(6666004)(52116002)(6486002)(83380400001)(1076003)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: JDJaCW1qaaPGH553efHdI8cg4/kcWWolnxluRMvT47pqm7HVonihh1vpmoTl9VYteL7dyWFsT4HWdBjRoMacdYFOQicIq6SjMEZz161TxUlbbCOSvAlEu+JOmsT0GDIsvue7eRqdhzc/dzojrVnbERfeuvos6FRPU4D+BnNu93nC6e/4TNngaHAQXSwCQ8lgKlZGToX4pzGgzZdbOeJVE8xoWbGpBaCxymg9g5uJbyZHtVijAuHbCyLZgVw6eQNe0cUFPKCBmlOpEPXaj5p6rD4jFGZlg6ZBZ/MkvbN+ZQGQFqtUTMC/Hx4GF6FDkzKccvzm24m5ziCmBfumgdoibQaCMh5On1LMp3jaVDWJIrzGlNT1vIh3Noy6qZf0EzFoxYE6IhmwMBL2JsRpVF/ajfsSYYB0D75TWRym6Ra0YtcD3vieUFS1YAVhvBfYKO5XW3C2NwSsbRya9FbsEOZJKws+v9fNJwCJx7m/TZKYyE7Te4yrkhdkLCT/XtJHC1Ly X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: d3c8ca3c-9cc0-4ae0-a814-08d82fdd493c X-MS-Exchange-CrossTenant-AuthSource: AM0PR05MB4866.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jul 2020 14:24:33.7384 (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: ny7TBXlno6+KzZkESZkJQApuGaxub3f5aDEDXNzlC/O/tj7m8nZNbX4Ju/09hbtTCSEtOEr8EXehdNcG3GWc1g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3203 Subject: [dpdk-dev] [PATCH v9 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 unintialized priv. Fixes: cfc672a90b74 ("regex/mlx5: support probing") Signed-off-by: Parav Pandit --- Changelog: 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