Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751584AbdIRFtU (ORCPT ); Mon, 18 Sep 2017 01:49:20 -0400 Received: from mail-he1eur01on0068.outbound.protection.outlook.com ([104.47.0.68]:45568 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751396AbdIRFtS (ORCPT ); Mon, 18 Sep 2017 01:49:18 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=leonro@mellanox.com; Date: Mon, 18 Sep 2017 08:49:10 +0300 From: Leon Romanovsky To: Sudip Mukherjee Cc: Matan Barak , Doug Ledford , Sean Hefty , Hal Rosenstock , linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org Subject: Re: [PATCH] IB/mlx5: fix debugfs cleanup Message-ID: <20170918054910.GE5788@mtr-leonro.local> References: <1505651288-4781-1-git-send-email-sudipm.mukherjee@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="VUDLurXRWRKrGuMn" Content-Disposition: inline In-Reply-To: <1505651288-4781-1-git-send-email-sudipm.mukherjee@gmail.com> User-Agent: Mutt/1.9.0 (2017-09-02) X-Originating-IP: [193.47.165.251] X-ClientProxiedBy: DB6PR0202CA0014.eurprd02.prod.outlook.com (2603:10a6:4:29::24) To DB5PR0501MB1928.eurprd05.prod.outlook.com (2a01:111:e400:c584::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8d2a4e90-4f92-43d0-cc0b-08d4fe58fe2e X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:DB5PR0501MB1928; X-Microsoft-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VqYiJmwCsEMzl9+Rpl5AaTwy1LA72149n/Ek4Fp6AxJ4ex8mS+xKB3cfgfnrf8LsK8kZuoxEFr2AHGgGO//MrE37nrBJix5eZ7ghRTLFUsFx+uvRudgr23WpME+8GJsbP7RoCJABI+ZenZIA1X2l8DWQ44z0ABRlkr356zZe4C1ofn9r4r3ewzm7LBmzIeXJGR4xYRI5Gmu0VFXO1OTs2Z++xsBc/6HUuVH++ZGh2c5ENYv4qS5rbXby5CakGQxz/4PY/rbmLGx6Tj7mPSWbF+xXuMxbe/ifJWuuEEZVYmq7fLMmE/NBkEyU72QpMW5KtNgCsg85vd+WkqG70a4KJwtlsJmWx9z1vQL2ebGdwzOqY687hbVHUYnnPlu;4:Ny4rgQrKIOgnUxnhJvHXXrN4JKQyrI1uOmyE5+zIdS0OZUUbQaqGkrsVRCZRokFh42VOl8PFm8kMjtCNw7b4eDFNO6zcYg9ubYrxjFnJ3P4lJiK0YXw8q0XFU1hbFgESmOuBV4EQabPNFJ5hVeMqu1GtSi1JQq28qIExZRriMBUm8SL+F0jpwVAVffZ/hKpo9JMWwecy/tpddZhLNwkJuRxg3BUQZDgc51WvPiJnyg3XA5iibhdLMZGD13jHk9noUWY3+3Axm0VPct0CBwRUj24hCZcZdGroWr/gP0X14CKZlP/m4GWLtmijFR8EbIHrEW9rXW1tpbTL/1DqlSLcWA== X-Exchange-Antispam-Report-Test: UriScan:(9452136761055)(131327999870524); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(3002001)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(6055026)(6041248)(20161123562025)(20161123564025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:DB5PR0501MB1928;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:DB5PR0501MB1928; X-Forefront-PRVS: 04347F8039 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(7370300001)(4630300001)(6069001)(6009001)(346002)(376002)(189002)(24454002)(199003)(106356001)(2906002)(2950100002)(105586002)(6916009)(7350300001)(25786009)(1076002)(6496005)(97736004)(76506005)(9686003)(966005)(8676002)(83506001)(81156014)(50986999)(6306002)(81166006)(54356999)(76176999)(478600001)(110136004)(66066001)(54906002)(6246003)(84326002)(53936002)(101416001)(229853002)(189998001)(6486002)(5660300001)(316002)(16526017)(16586007)(86362001)(6116002)(21480400003)(58126008)(98436002)(33656002)(4326008)(68736007)(3846002)(7736002)(345774005)(305945005)(18370500001)(2700100001);DIR:OUT;SFP:1101;SCL:1;SRVR:DB5PR0501MB1928;H:localhost;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;DB5PR0501MB1928;23:C9gJPeCzijYbaMw/OR+CFrB8VeLdDP9VadKV2tK?= =?us-ascii?Q?HGB/B9jN3M1hWUF10TPFLpGTTpEv7qDBunMJB2ghxEdbDX0/duU+tk/wbKBY?= =?us-ascii?Q?qN5nA4JUklmc1Ioqqj/23UavDLE2QvL3uFp++CbnWonoWmx9HjLFAtmLE3ZT?= =?us-ascii?Q?P96tWj5JQwIS3ZNcIQHTeZ/RE2mrUl7Z7Sv107GeSWsqwPJ/imXOc90EfgdJ?= =?us-ascii?Q?XyVFZ72kq1/qTB/B3H4J1a9fOJ+sx0VhBKxCQ97f0e33Uxli3z7MWTapfAk8?= =?us-ascii?Q?2GkrMnvqLveq/ghUBNiHcfdzQBWWkHHRMqCeOWjEGl1O266jkUIjhl+0FkAm?= =?us-ascii?Q?i+LKc8ZNnesy9/jKyZO/zK1IuWmrDVeFbCrTqy9Ynu/JmyT7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nosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2017 05:49:13.9733 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR0501MB1928 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3103 Lines: 90 --VUDLurXRWRKrGuMn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sun, Sep 17, 2017 at 01:28:08PM +0100, Sudip Mukherjee wrote: > If delay_drop_debugfs_init() fails in any of the operations to create > debugfs, it is calling delay_drop_debugfs_cleanup() as part of its > cleanup. But delay_drop_debugfs_cleanup() checks for 'dbg' and since > we have not yet pointed 'dbg' to the debugfs we need to cleanup the > cleanup fails and we are left with stray debugfs elements and also a > memory leak. > > Signed-off-by: Sudip Mukherjee > --- > drivers/infiniband/hw/mlx5/main.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c > index ab3c562..fba1920a 100644 > --- a/drivers/infiniband/hw/mlx5/main.c > +++ b/drivers/infiniband/hw/mlx5/main.c > @@ -3870,6 +3870,7 @@ static int delay_drop_debugfs_init(struct mlx5_ib_dev *dev) > return 0; > > out_debugfs: > + dev->delay_drop.dbg = dbg; > delay_drop_debugfs_cleanup(dev); > return -ENOMEM; > } Thank you for doing that, I would prefer to have the patch below to set dbg pointer in one place, together with following fixes line in commit message: Fixes: 4a5fd5d2965c ("IB/mlx5: Add necessary delay drop assignment") Thanks diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index ab3c562d5ba7..451aed790248 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c @@ -3837,6 +3837,8 @@ static int delay_drop_debugfs_init(struct mlx5_ib_dev *dev) if (!dbg) return -ENOMEM; + dev->delay_drop.dbg = dbg; + dbg->dir_debugfs = debugfs_create_dir("delay_drop", dev->mdev->priv.dbg_root); @@ -3865,8 +3867,6 @@ static int delay_drop_debugfs_init(struct mlx5_ib_dev *dev) if (!dbg->timeout_debugfs) goto out_debugfs; - dev->delay_drop.dbg = dbg; - return 0; out_debugfs: > -- > 2.7.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html --VUDLurXRWRKrGuMn Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEkhr/r4Op1/04yqaB5GN7iDZyWKcFAlm/XlYACgkQ5GN7iDZy WKeGpBAAuz1MKnzYoD6JtnqqLZ+IOtI+IFJVQ173eEXl5cRN0KEb6FxB91mMHvAG gK5ThWwL0exhNlaz73398kXNycDVHMDKuseH60hlul/0g5kdhaGCL85l9GWEsieK cZgrS5XHvfKsN5xzk3Ea/ZSAmnZWkUNLTqDioVmfBMjwq9QwTD0iTQZZMJkkzRuo ykL/GERlrM7ercX6XPpvdqWg1bjFMvT2iCQpST9eZOSppgyR7LGdZDBDKC47TZ3B qV+ea9/72LNtlIMwhz9ILfCvd45NyjwPqWa8TI7kDzW+y/JzkBv0l+h4Ysct8DT8 6sDGQoMn8FIxYH5TpsPsKMIYaI3ulnKkI6y8PnZ77R2lg50Jd2kypNy06I4mCrKZ OOklQzOj7hpf57lnnYVRiQbnGnQtwsgI2e5iBg5G/1EflLn6QyDkYdo8e6TvP23P wtiNTeLMqLm1wEp106VfIk1WmmPLagDixXVuQCD0yeI0eBke/FRhpGZfAR5qzEse haWl+f89+3tv3b7c/v1/d6aji9QHe7v/tD5S4Sx3Sht4WEC7HQX0pmcxaqwyCxU0 ITOWxBqcojKtP7YmLAB0vK1UQ5s+u/2caOK/UIBOWTqutUtle9dGJyutrK4obNgq sVYcJWuAqslKB+sUGKnF1+MMv8joLEcrcUzMS4wKrPQMmAWmeQg= =eAcD -----END PGP SIGNATURE----- --VUDLurXRWRKrGuMn--