From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0050.outbound.protection.outlook.com [104.47.2.50]) by dpdk.org (Postfix) with ESMTP id 75A316D3B; Tue, 8 May 2018 11:11:45 +0200 (CEST) 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; bh=G+BkBB+n8aEwjodoPcU+PExFFY++MFziVBIEjg5Yw9o=; b=Vc1PFv5ytT43nwIldMpOdA66piju+2p+Dhh4j5GxBFpneF5eNmHoUOGxzoH6EGpUDYoIFktsur5i035EO66IB1iGp4uESfTnOav2h7JeISIeZ9Gh2FtRVNpRVc8cZOFmQ2bB3Cg8s0BlpgpRCgo/rO1fAdth4d3s3mpfdwxf9RQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=rasland@mellanox.com; Received: from mellanox.com (37.142.13.130) by HE1PR05MB1259.eurprd05.prod.outlook.com (2a01:111:e400:588a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.735.18; Tue, 8 May 2018 09:11:41 +0000 From: Raslan Darawsheh To: shahafs@mellanox.com Cc: dev@dpdk.org, thomas@monjalon.net, ophirmu@mellanox.com, rasland@mellanox.com, yskoh@mellanox.com, stable@dpdk.org Date: Tue, 8 May 2018 12:11:26 +0300 Message-Id: <1525770687-22980-1-git-send-email-rasland@mellanox.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: VI1P194CA0047.EURP194.PROD.OUTLOOK.COM (2603:10a6:803:3c::36) To HE1PR05MB1259.eurprd05.prod.outlook.com (2a01:111:e400:588a::13) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(48565401081)(2017052603328)(7153060)(7193020); SRVR:HE1PR05MB1259; X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB1259; 3:3cati5hes0ezOLlu/j3nVxxoz7dsbg9bqrxRAqw0t5ryxkaj2H6PBPEh8SP9ydCDujUnw1mZG4qnoH7iCKo72OfRwk11u4q1Srgn0xgKNIhzBa+lZrqm5SesOYXnvRkHT2wPNIDBbXkzaMX599A8xi1aijhWEaLDAkuTG/6ViVys1llWST/1eu/pO8aFpEVt8504ucvfEW2Zg73u1K6eVsWFD/M2Th7LeXRHUu72AiA06kj/LBaqDmQ23AmB92pu; 25:34J2jcBq+wSCSofBNCgcxFF2QbyqzrT7LW5GDbxFxY9EgmZF0wnw/o5MajHncNZiROc8GO20uoYbgwtqS28s0KmBw8sxlP6BGWzTZ31tC/z1/rjYnKbRErgThD/6+B947xC389SJvL6bO5N0aHew7VxbnUCsn0n4QrEwDCiBoLzRdlNL2M70G4mQSdCZslAXPl6BSGUk++nzO4CuU6jx9rQ6wD7kwv9goN7dZm5VUzUpgXhZnTU95QCWVw89AKCKJujjoR3VV430ZELodqnHsxtAetFycd0VJGGJ7TVNba9vZuTo9BZ8pp2JrwD8BdXrK8Dap5fc3h1F6XybLQgGFg==; 31:6PdU4wOJuRA0JOratOSNxuIBqYOoPbeJeg8kyAbfw1y6ZfEI5TS8D/swUcyH9hDmkQSs8Upi91+ZpB9wLWw4KfjAcsehS4HcC7XkGs8p6xmKwSeCPITKo1V6NZktHXfch1iv5lNWq5ojWAYystmmrt17gmznT9mPpyuhjVhBJcXe8Ja9EMsCfkHWFvCYS30gKXOYkh4NtpYJDRJ9Z4CwMuaQAaF+t+J3YblCDJRb9j4= X-MS-TrafficTypeDiagnostic: HE1PR05MB1259: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB1259; 20:u27rKBGxMjXJrc1ZhVlYElP+9D4b5cSm+MjOguCxDFF0QsvIQL4VkCLllwm2yIZPa1dDZZmOBpsDOdAz3xk+8EAMVBFDB9RyGD95enGzUK28b2y5IBnEjpZOz2MbyCTw59tj8TnpAWc7j4djR5vcjC0O58oFdgyrJBvgqXD3CF6NxryrCDmVs7MrsKmAaqKfgVIUPmV/IuwGSsGrtemA09YgnH81cun8qAJr+nbDY/ObeV0tSOd3JR8jvnTtvIkzulF1jBYzRZExzH+Q92+ihL45dUShhjCvwhROKrGHwhwc97I9pcDD04X7VdP+LVfr77lm/PQyIZm5wvojklFDaXvNpevhf9/uCs18EazvvBn+Zf4nzqJJU5GlHiNh9J8FccwkVzRuAjRLTJQ9R3eVfHA4+fbgs7LuPn/Kkj8nPLeHIfL9CKfD14NRTvraUxiBe5oUsDZmprhz90W2iK81Xfc4vhav/Dl9dXA8WA0s6UiGUMnszSGYa5zapcciP8pi; 4:jWCOsmuuL0bbRnHf8QvdmV4IOkKEEzNmV8I5WJmbgNYVbaowp4k5XzlnUtaDD/dKtvwaW+GTOT0XI4eBrociCRtZLkslGoCQUO1nnDwWVRkgVvq3Ma0AXUUevaUgZjA/3aZVTUdDikkkxBIL/jf9rIVzwG4qDHMfOBokBI5Fsby/TGa7GFZp8pTStz3Q2K2gQMyLvUSKj2N3eQBIBLUpUGJ4foZWrcEQ+whoUs2lUQUvtDeF0Z/qByQOvYfcgycX4fHsmnZUh6mGxyWT7jS+Lg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93001095)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123560045)(6072148)(201708071742011); SRVR:HE1PR05MB1259; BCL:0; PCL:0; RULEID:; SRVR:HE1PR05MB1259; X-Forefront-PRVS: 0666E15D35 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(366004)(346002)(396003)(39380400002)(376002)(189003)(199004)(50226002)(956004)(476003)(7696005)(81156014)(68736007)(51416003)(8676002)(86362001)(53936002)(8936002)(2616005)(66066001)(55016002)(16526019)(97736004)(486006)(105586002)(4326008)(7736002)(81166006)(52116002)(33026002)(25786009)(478600001)(34206002)(6116002)(47776003)(2906002)(21086003)(3846002)(2351001)(386003)(59450400001)(26005)(6636002)(6666003)(48376002)(50466002)(5660300001)(2361001)(16586007)(37006003)(36756003)(316002)(305945005)(106356001)(69596002); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR05MB1259; H:mellanox.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR05MB1259; 23:gX71sZ5or2DP8fcI1CpexRugJH5JGyT+APtR9LWzB?= =?us-ascii?Q?G8NuZVSJXpSAkQfc94peh5tJbSJGsCK55Z7rtTEfCXnrVVEQrPnZHdiGju7s?= =?us-ascii?Q?bKcVaKBAjPYXPLxmvJWOz134R2yDQKTYg03w75CyZbgyyE8PsTYy7m7SJNwc?= =?us-ascii?Q?ns6LdzgkxnaofyaidaaT7JJq05zUt3k4NC1mGjm/H8+55kzoUcKvacWM388R?= =?us-ascii?Q?Enr880m9mgXcIVCrLEl5plzYet4f1YVTqcnFvuuTuGCYW57Dgs8AMOW+GO2p?= =?us-ascii?Q?CdN+6NXsKBGiZIiGJ6k1pzM4uKwOORLFSu9SEJdZBjZXKy3PxSp1MdD/2X+x?= =?us-ascii?Q?LwFCFFYJUeWjQRg+piG7v5AuvmyuU/9ekwuLHfIDsz1RLbp8xkIrQmoGqLjI?= =?us-ascii?Q?IWADDx5c2Lf9yxDASVhwE/j3mi0XUV8Cx3nTxVK/znbyeq2hJ6eLyiFLpi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+/JaWVWMuVjlxmnq8bdwAHghZCh26awWAtpYBlUfjp8DaQBL5DjLaZdcQv9aYKpCarcvKKoRLV+MUzSSR4wIyWNpOVGbDprk7xZkLnzLidyatjhKFhz+tXAs9K2Wz7dKqpff5dfJLM6X5cInPgtHaEj3q/xYD X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB1259; 6:ZRv5llKnwZDn0UcWP8JHhEE8gzwk5E4CoRuHOlW7tC2XxTJ2u1njpp7xUsQ46fNoiFNLkTchFnRJsPWckR1sePJ+Cbv32ykjQ6c3xP6mjd0TyXFsQUvSskuUpPQzosJYlbArQQgjG0IS6TDrXcSF9OlXJXVpWVEN4MBzWXaZ1lAC+NIj6H2N5cCTy9shIIDVRdtSjUzS0uZ8uGNDvXS9UeufTvhpWkXV/6wsCwzrJYQNOa6y3XbIFiJ63ZfovVw425dWPOJ2nT1raUNDOBwpWNIhQ8jTLCI3cJa1wXH1JdAQLcSONKMP3P37fny1gYbpPBXoiCTBILfSb51ADsuZh4EacxEQtM+TW2I7c94owq1UsAsmuKKGLpw4AfqNv+zaNTni6wsBmaAUblTtN68le8/1ReSdhTJsfLvwUhoit5AX+49GYCHuArSXOutj+cKwRWOSkzkU1/Qhvp7/ylWVZg==; 5:uQQhd+O2f89W1JhN5BmFu5ztF1QgVwni0zOpfKIC4tMwgB4vDQbz/8nt9lU/9vJMEzVfPtehM052EjcllWtJDGQZrPV6aHHeCvgV/nO7JYWROA2k5vc0qD9BxUI2HDWyTEg/i7mqzQCVwnEv1cGh5ixynzIti55/dzy87NZgZl4=; 24:+wzxgqyJIWXvjMIKEWtEppo72+pqSZyABvyqxX1lhghC/W5dM/FF4CkVjepbcGWfV7r8mazrDxss44QDEsdXJULghX6LifbSlmxqyYd4xhg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR05MB1259; 7:BCzFehdnGrhWDKwg0bSFeq5+fjlB7DH4+o9dlPIMb3+gXUfZ9FE6CA/XEMgxgUad6TwfJAhFmNz8x5H3x/b+8DowewTwXPplAVHrLCO6Qq2RLzsIap2rX9nSqN56Nvsk+KTYPSseZlbVi3890/75znGdSvyLUct2W699RbTomhVD8R9b3Ls+VP5s3sJhEVPKRY7MO7cjBLzgOAiTEiBc5m+78W0ybpJLPZUzBvizSROcjmMeGdesm3MB4HfUth7I X-MS-Office365-Filtering-Correlation-Id: 5d126458-4a63-48f9-4d46-08d5b4c3b72f X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 May 2018 09:11:41.4620 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5d126458-4a63-48f9-4d46-08d5b4c3b72f X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR05MB1259 Subject: [dpdk-dev] [PATCH v3 1/2] net/mlx5: fix double free on error handling 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: , X-List-Received-Date: Tue, 08 May 2018 09:11:45 -0000 When attr_ctx is NULL it will attempt to free the list of devices twice. Avoid double freeing the list by directly going to error handling. Fixes: 771fa900b73a ("mlx5: introduce new driver for Mellanox ConnectX-4 adapters") Cc: stable@dpdk.org Signed-off-by: Raslan Darawsheh --- v2 changes: Better handle for switch statement. Reword the commit log. v3 changes: Reword the commit log title. add more figures to the Fixes commit --- --- drivers/net/mlx5/mlx5.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 5190b9f..3831e3d 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -690,18 +690,18 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, break; } if (attr_ctx == NULL) { - mlx5_glue->free_device_list(list); switch (err) { case 0: DRV_LOG(ERR, "cannot access device, is mlx5_ib loaded?"); err = ENODEV; - goto error; + break; case EINVAL: DRV_LOG(ERR, "cannot use device, are drivers up to date?"); - goto error; + break; } + goto error; } ibv_dev = list[i]; DRV_LOG(DEBUG, "device opened"); -- 2.7.4