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 035C4A0527; Fri, 24 Jul 2020 16:40:19 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DBE681C0B1; Fri, 24 Jul 2020 16:39:38 +0200 (CEST) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80072.outbound.protection.outlook.com [40.107.8.72]) by dpdk.org (Postfix) with ESMTP id 43F7C1C06D for ; Fri, 24 Jul 2020 16:39:36 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Q35rHt9HIkSUyi9CgTmKHsJgDKlrchGGkzTw0sY+F+1St+hhK+Cqzs/4ZCbsF9HfnBjBl2Sn15DGjYyuwmp9sbSGI97+aECOjH84zFJ6IfYr5YWG4FrZd6BTnGR/d5Ukx4zrxRI7Vj25WnBHWH3q5+Wv8ZYEwxoXDFreduIrjrr+V3ONml1bzkfs+BIpcvBaCLG+uovYXHrvopYuD+GewtH5CJMmX6q29BgT4BlugYE/aBX5piAagjNHxD5IU9fcaz3BFSfOaG2jwEDwk+QcbBo7MdtcL8ayTHMA/JtqUDdrtdT9yk5p91CH9QdAY4t1pNyqw+wTfxvopyVhlqMwyw== 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=D101udOBq4dZZmgzys3eTVKO82mBybM+L37yZ+D8o70=; b=nXCqm+EX/cqpy9TXMyse+KB0+NsNryU/xEgkbx3D1uvo5a+SowQQYNjELH8pvL4kXg9oxad1eokbdWoRat1AFeCjGhf6qmmPOXRCuKMsSImnJOqM5GijIGgxpdk0VLxXSib0G9JYrkHQXJUchXzKW02iOwM1m3t4Z+BVIxaTkjUHhyXLOKO1XO/TsZqQw44oI7p5pBvvW9JwMKodiVevvgRDdJnHUcu9kVnVjICvAx1tRUuxoZBNRMhHan3M9xH3gOnr6NMnZRa18a1cRct+DTTcj+4TzCdz06yZd8wgNYB+4V/2Y7lsBhdQRJVubMOpfBxf+hkyELFzCA1F8GXusQ== 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=D101udOBq4dZZmgzys3eTVKO82mBybM+L37yZ+D8o70=; b=TJaXc9+5Uf1vVDXUuWoF9GWv6QtpImD1GmWI2qnB0zv51q8oyzKIiFLalxaHSwl6zTAuhN/O9FWyDTS55hx1+/lgCZ4ovfY4tJBPf1YGEoX4loelYK1DGxp3YN8i+opMPpOZgGWLhhjlckCxO8JKeG+vHo21RE7nBPBoNmTbAsc= 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 AM0PR05MB4962.eurprd05.prod.outlook.com (2603:10a6:208:c3::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.17; Fri, 24 Jul 2020 14:39:34 +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:39:34 +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:39:01 +0300 Message-Id: <20200724143906.7453-6-parav@mellanox.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200724143906.7453-1-parav@mellanox.com> References: <20200610171728.89-2-parav@mellanox.com> <20200724143906.7453-1-parav@mellanox.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SA9PR10CA0025.namprd10.prod.outlook.com (2603:10b6:806:a7::30) 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 SA9PR10CA0025.namprd10.prod.outlook.com (2603:10b6:806:a7::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.23 via Frontend Transport; Fri, 24 Jul 2020 14:39: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: f9371a0c-0b2c-4cfb-1ee3-08d82fdf6219 X-MS-TrafficTypeDiagnostic: AM0PR05MB4962: 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: ze0m7LMXd9k7mHVqKKehG6i12hTLbbQz9ZHRSejJTGvCwXBOXTDTmXYzHBGb9ouYlvUbBdkLKQAy3lSxclK6i7kPxXTMQAaUOv2t1Lh7qlBUs8viqfP6KrWCJ3VphnDs63xKHhE1HfRhg+B6qnvdscP0DYb8BqSqNMnNX5LcsEE4eH5+Go5g5OCk/xwReciMw0XdpE0zf8fjfFEdJkQ7X78uG1ztRZ2XAklmzE2X+BB8u5V8B57+GAo+Ry2QGTz9ohQ1h5DcP+9vCl04O2tGUCNZ8GXhQTUTBTKRdJ4IXZWmIxsp3MytFGbetNJJc90Pxkf8wsA/GjlRYls+AYGJ0Q== 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)(396003)(39860400002)(346002)(136003)(376002)(366004)(8936002)(36756003)(1076003)(4326008)(26005)(52116002)(2616005)(956004)(316002)(6506007)(478600001)(16526019)(66946007)(86362001)(6512007)(83380400001)(8676002)(66476007)(66556008)(186003)(6486002)(5660300002)(107886003)(2906002)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: exgrQVdB0kjOkapQgEb0z+ho6HNhpg8avtuhmXdFHyZV4OhcSSHcccr66IRakWh0WQgUEElBqUXqc2XWlza84PNuyNRzCqAUv0VVoCan8obZ9+HdDnjPkr7J71lQ3BhzA6GHiM5KdHVVbAOsRiTkijKqZfL88Yqkvynf6aIxas21+L6Z1zsdujoo3kr49Jj4nRjTysr7hzXmB2KJ37YstR0zwEjAkTlIXWpvZxdtjAqwQrKU8EVvwn6kCmuVedyQYWIQ9hBwxXfc6/LUuDgIKq0GOKDHhOQvqVlnTjDI4uoVjNxupjypJ/nUJQL5PYddjW+I0A7a5VdGdTm977fBVQMJ90K9cu6ubGSs4xUSKNbuUAD5wshXVi+J63CryouUi5ei7HqKNKbEL0iy1swZJCKCjO2Bns78ZoF5i9GchdPQRuz984uSwGzHFtjWu9kpAVu6e0EdLfWh51qzJ19eH2pnK7/Bb7FnyZhIHDj9wmVhG9OywDRo2ClLnpfxSM6z X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: f9371a0c-0b2c-4cfb-1ee3-08d82fdf6219 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:39:34.4420 (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: NWBzcoKMoCjnPuVJsl81eJNechUZFLW94gBN7hgJBahgcYC/kF5PKXPd36/fq1WGAj9Nh87uSNwKVBFV2o1nsg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB4962 Subject: [dpdk-dev] [PATCH v10 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: 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