Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5645799yba; Mon, 13 May 2019 14:43:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqyOPzXVe6edGc0OTpAupvpkIkSjYaiUAuCpwLjC9eNz4/q29z4f04zI4TSwjGcSAlrcwof8 X-Received: by 2002:a62:5487:: with SMTP id i129mr36725903pfb.68.1557783819017; Mon, 13 May 2019 14:43:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557783819; cv=none; d=google.com; s=arc-20160816; b=pbggQUz7mag9pwpg78LJIswCWv2QI10CCjivDEAweTtEY4e6MebwtGDix3jfDrUY5b dga4yE0lVTB2JSXmcEjdFdG/WIwwg/CkjaZy3LWkyKydd//jA8zrwKL4UQ+oOBgKRx/M 6Yjm+7Lra2dHwGVOT5mhLrS0ZosBquBj/IOBzTrI0PYXu+sHMCZsOkqFBIpLNZOD8Klm TLRD4pr8TiS0bQjHmPEQtwE0+aBiqwHdYkXcL56dLsDKdCx6nc/+JfgZLsG5+Yv7JQ0H sayJZ75Pu4ddSn5o1tvY5rYX53dOloF0LAx08ETyo4b0bpgDwyjaTw7GEPcwDILBrMz7 ugkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature; bh=Vn/T/POBtkQCivubXNnOyOKOoXDswoy+p7rd61BSZqE=; b=QzSIiikveG47fHd1jGgcSXI71mTL+Tn6ItdpQZbL/LKxkl66wAr25THI+Oe1gs9JoI +zu7/JcgfX3Mu+bbQ3ig+xgIs/bZAUgzsRrPyc1N27xjQuhGOk9PnviuzSuMt0WDIgaO J3uP+z8DtcQdRUGGLRv8jTQxkxJ/HeaH95buRjFR1QvwVpYuZnrxT5HB/ZMa5IJ335dM 9yKppXsZW/ne5NawLikddIcC80NVC5loB/AG2unBYJFqxOPcZXiJ7KEwpebR/bGXnftF 3hPzGgXdC8f1LNU3Bseq7RPRnaC/LT81A9Sk4v2woV8HX+zURim6aulbkDAl3gKch11y MsbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tobin.cc header.s=fm3 header.b=BvZ23USq; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=hnx7+g5R; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o70si19330578pfa.33.2019.05.13.14.43.23; Mon, 13 May 2019 14:43:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@tobin.cc header.s=fm3 header.b=BvZ23USq; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=hnx7+g5R; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726511AbfEMVlQ (ORCPT + 99 others); Mon, 13 May 2019 17:41:16 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:40285 "EHLO wout2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726174AbfEMVlP (ORCPT ); Mon, 13 May 2019 17:41:15 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id E36E05C2; Mon, 13 May 2019 17:41:11 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 13 May 2019 17:41:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tobin.cc; h=date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=Vn/T/POBtkQCivubXNnOyOKOoXD swoy+p7rd61BSZqE=; b=BvZ23USq+n0H6bFfinEnI042Scm2YF1IK4T/Ipy1oA7 EnMtmM24XOtJG3N6yUG9XfvPeAZ/DSmgYOungx4VobZ6ghiLq//Xwp0sr5EEG7tM Chzj5aZKD6m7W1TvsCqEtWYJStcGCVl5G+L6L8KT4XKk/Q49y9FrPvwUw/u5w5D7 O5qDuZBkWjWLkA8eVdRxL4ZDD4N84oiQQg70BWtobahYl6yrquda8wBvHZGUs04V KYsqffXOd3dFefZHvErodbuAPP7ralWwr5/PUjmwOHIPcRoJ33o8+xbuQoRLhy1b S+15WBT9/o6/uFE9+rF5lgoLuJ8F+DzCb3RRLdnM1ww== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=Vn/T/P OBtkQCivubXNnOyOKOoXDswoy+p7rd61BSZqE=; b=hnx7+g5RF4XXPsmU/JIrvk trc7cyfb04VRdoTVoe6lKHx3US8i5l74WHwRKYREd8NxzoJ5f0nOTy1M+wkndKvQ s36lQuteqU+wHNSrt27kx4eBalmY3U7wD/jg1Z5IgxEKOZZkUG1dAnxwkJKDRIZM WGjxtno8qEf25ApyCQubPFDreAjW3PRnIJWgKKRg/RgBScFbfFagIq9ZZPRXGGMW 45UJP80rwyEROZa4jRQ3Xpd3vJ2I1jtMqXEB559MMNKKwZLuzZBzxPr7qofa7ejV YkFZA7q3aCJ7IZ65bQZZS2tVhrsdzechSy+eWC2ALV6kf0kmor9G9G0gMsENPrkA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddrleeggdduieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdludehmdenucfjughrpeffhffvuffkfhggtggujgfofgesthdtredt ofervdenucfhrhhomhepfdfvohgsihhnucevrdcujfgrrhguihhnghdfuceomhgvsehtoh gsihhnrdgttgeqnecukfhppeduvdegrdduieelrdduiedrudekheenucfrrghrrghmpehm rghilhhfrhhomhepmhgvsehtohgsihhnrdgttgenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from localhost (124-169-16-185.dyn.iinet.net.au [124.169.16.185]) by mail.messagingengine.com (Postfix) with ESMTPA id 9515E80063; Mon, 13 May 2019 17:41:10 -0400 (EDT) Date: Tue, 14 May 2019 07:40:39 +1000 From: "Tobin C. Harding" To: Andreas Gruenbacher Cc: Greg Kroah-Hartman , "Tobin C. Harding" , Bob Peterson , "Rafael J. Wysocki" , cluster-devel , LKML Subject: Re: [PATCH] gfs2: Fix error path kobject memory leak Message-ID: <20190513214039.GA27187@eros.localdomain> References: <20190513033213.2468-1-tobin@kernel.org> <20190513071405.GF2868@kroah.com> <20190513103936.GA15053@eros.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Mailer: Mutt 1.11.4 (2019-03-13) User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 13, 2019 at 06:41:23PM +0200, Andreas Gruenbacher wrote: > On Mon, 13 May 2019 at 12:40, Tobin C. Harding wrote: > > > > On Mon, May 13, 2019 at 09:14:05AM +0200, Greg Kroah-Hartman wrote: > > > On Mon, May 13, 2019 at 01:32:13PM +1000, Tobin C. Harding wrote: > > > > If a call to kobject_init_and_add() fails we must call kobject_put() > > > > otherwise we leak memory. > > > > > > > > Function always calls kobject_init_and_add() which always calls > > > > kobject_init(). > > > > > > > > It is safe to leave object destruction up to the kobject release > > > > function and never free it manually. > > > > > > > > Remove call to kfree() and always call kobject_put() in the error path. > > > > > > > > Signed-off-by: Tobin C. Harding > > > > --- > > > > > > > > Is it ok to send patches during the merge window? > > > > > > > > Applies on top of Linus' mainline tag: v5.1 > > > > > > > > Happy to rebase if there are conflicts. > > > > > > > > thanks, > > > > Tobin. > > > > > > > > fs/gfs2/sys.c | 7 +------ > > > > 1 file changed, 1 insertion(+), 6 deletions(-) > > > > > > > > diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c > > > > index 1787d295834e..98586b139386 100644 > > > > --- a/fs/gfs2/sys.c > > > > +++ b/fs/gfs2/sys.c > > > > @@ -661,8 +661,6 @@ int gfs2_sys_fs_add(struct gfs2_sbd *sdp) > > > > if (error) > > > > goto fail_reg; > > > > > > > > - sysfs_frees_sdp = 1; /* Freeing sdp is now done by sysfs calling > > > > - function gfs2_sbd_release. */ > > > > > > You should also delete this variable at the top of the function, as it > > > is now only set once there and never used. > > > > Thanks, I should have gotten a compiler warning for that. I was feeling > > so confident with my builds this morning ... pays not to get too cocky > > I suppose. > > > > > With that: > > > > > > Reviewed-by: Greg Kroah-Hartman > > > > Thanks, will re-spin. > > Don't bother, I'll fix that up. Thanks man!