From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0054.outbound.protection.outlook.com [104.47.1.54]) by dpdk.org (Postfix) with ESMTP id 806712C6A; Mon, 7 May 2018 19:22:16 +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=4Hn4MglGOOqRknbj/6MrfMuTfSLj6twgGp1t1DHU+lA=; b=r40QPynxPDMVsUoplZzoBlil3WwRQVob44pMTIHrHrQP1I4TMN8PulMWckOSzsaN37ydvLv7zcHTUC0+2zQaWWijkLAUU4XvfvhwmrbkZ2d15XUMlFyI3zcVJ46zw7tHfim7DYWBQBq0lRaoeQeHDwgIhGXUNQjif+O1f9eqapQ= Received: from DB5PR05MB1254.eurprd05.prod.outlook.com (10.162.157.140) by DB5PR05MB1349.eurprd05.prod.outlook.com (10.162.157.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.735.16; Mon, 7 May 2018 17:22:14 +0000 Received: from DB5PR05MB1254.eurprd05.prod.outlook.com ([fe80::f1d7:3ad4:c20e:c08a]) by DB5PR05MB1254.eurprd05.prod.outlook.com ([fe80::f1d7:3ad4:c20e:c08a%13]) with mapi id 15.20.0735.019; Mon, 7 May 2018 17:22:14 +0000 From: Raslan Darawsheh To: Yongseok Koh CC: Shahaf Shuler , "dev@dpdk.org" , Thomas Monjalon , Ophir Munk , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH 1/2] net/mlx5: fix multiple free issue when attr ctx is NULL Thread-Index: AQHT5ibZMKODEtV/kU6fPyXqxfY5I6Qkg5SH Date: Mon, 7 May 2018 17:22:14 +0000 Message-ID: References: <1525695534-15072-1-git-send-email-rasland@mellanox.com>, <2027735E-4EF9-4ED1-AC07-7E2AF59263FC@mellanox.com> In-Reply-To: <2027735E-4EF9-4ED1-AC07-7E2AF59263FC@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.164.245.112] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB5PR05MB1349; 7:CkDOwPCdSVxp0xPbwoS0OtN79uV/KAou+7AMgdpluGUGN02tpqxQgXyu2SDrIrZ5kkHNMqQH7jUuOfCQI2o8dk9/aCC+ubU+XP1O5VRDuIp+6FrKrnr5O8eCfLlEa+5zhtFRwymwCselHvjRfA3rUkgDVTZwqUQ7u7DiCOrr4yyIGM6dZlPyCrTT5Nk3FAbaWoL8moLLZcjxDGVL8zVS4+r1gfObjSr3iL2OHS6WsW+Q1ehv5+VUgQ9c2jaquqgT x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(48565401081)(2017052603328)(7153060)(7193020); SRVR:DB5PR05MB1349; x-ms-traffictypediagnostic: DB5PR05MB1349: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(158342451672863); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231254)(944501410)(52105095)(10201501046)(3002001)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(6072148)(201708071742011); SRVR:DB5PR05MB1349; BCL:0; PCL:0; RULEID:; SRVR:DB5PR05MB1349; x-forefront-prvs: 066517B35B x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(346002)(366004)(39380400002)(39860400002)(376002)(199004)(189003)(8936002)(25786009)(54896002)(55016002)(478600001)(4326008)(9686003)(6346003)(74316002)(6862004)(6246003)(3280700002)(14454004)(86362001)(7736002)(6636002)(5250100002)(105586002)(81156014)(81166006)(229853002)(53936002)(486006)(68736007)(5660300001)(106356001)(3660700001)(11346002)(54906003)(76176011)(6116002)(97736004)(3846002)(7696005)(26005)(33656002)(446003)(316002)(53546011)(2906002)(476003)(2900100001)(66066001)(6506007)(6436002)(59450400001)(102836004)(99286004); DIR:OUT; SFP:1101; SCL:1; SRVR:DB5PR05MB1349; H:DB5PR05MB1254.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=rasland@mellanox.com; x-microsoft-antispam-message-info: UoLZpEpa/Q5cvRy33b2nvJ3XV028nM7IANgdfds5jEoZMI61sMnjJHZs2im3nF259pSOWdAm2Qced9iX0gnJrFHSCstdfwJqi2NAtB4hjVnki48E9lQwK1xnENi4higXFL4fUeXLV7XcVaPFyrC/+o4BJVl9rMZEbfI8OAniCvmSYYdby1wkQqYswxWTjkd7 spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: dccfb302-eab4-420c-4be6-08d5b43f139d X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: dccfb302-eab4-420c-4be6-08d5b43f139d X-MS-Exchange-CrossTenant-originalarrivaltime: 07 May 2018 17:22:14.6089 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR05MB1349 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH 1/2] net/mlx5: fix multiple free issue when attr ctx is NULL 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: Mon, 07 May 2018 17:22:16 -0000 Hi Yongseok, Thx for your review. But I already sent a V2 for this patch which handles the redundant goto tha= t I had. But still missing the fix for title. I'll submit a v3 tomorrow with a fixed title. Kindest regards Raslan Darawsheh ________________________________ From: Yongseok Koh Sent: Monday, May 7, 2018 8:14:22 PM To: Raslan Darawsheh Cc: Shahaf Shuler; dev@dpdk.org; Thomas Monjalon; Ophir Munk; stable@dpdk.o= rg Subject: Re: [dpdk-dev] [PATCH 1/2] net/mlx5: fix multiple free issue when = attr ctx is NULL > On May 7, 2018, at 5:18 AM, Raslan Darawsheh wrote= : Please don't use PMD/code specific words in the title. I suggest: net/mlx5: fix double free on error handling > When attr_ctx is NULL it will attempt to free the list of devices twice. > So, changing it to be freed in error handling only. > > Fixes: 771fa900 ("mlx5: introduce new driver for Mellanox ConnectX-4 adap= ters") Prefer to put 12 figures? > Cc: stable@dpdk.org New line here. > Signed-off-by: Raslan Darawsheh > --- > drivers/net/mlx5/mlx5.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c > index 5190b9f..d34076b 100644 > --- a/drivers/net/mlx5/mlx5.c > +++ b/drivers/net/mlx5/mlx5.c > @@ -690,7 +690,6 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_u= nused, > break; > } > if (attr_ctx =3D=3D NULL) { > - mlx5_glue->free_device_list(list); > switch (err) { > case 0: > DRV_LOG(ERR, > @@ -701,6 +700,8 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_u= nused, > DRV_LOG(ERR, > "cannot use device, are drivers up to date= ?"); > goto error; > + default: > + goto error; > } > } > ibv_dev =3D list[i]; > -- Nice catch! Looks the goto lines are redundant. How about this instead? diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 5190b9fcd..270f59b27 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -690,18 +690,16 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_u= nused, break; } if (attr_ctx =3D=3D NULL) { - mlx5_glue->free_device_list(list); switch (err) { case 0: DRV_LOG(ERR, "cannot access device, is mlx5_ib loaded?")= ; err =3D ENODEV; - goto error; case EINVAL: DRV_LOG(ERR, "cannot use device, are drivers up to date?= "); - goto error; } + goto error; } ibv_dev =3D list[i]; DRV_LOG(DEBUG, "device opened"); Thanks, Yongseok