[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190513174707.GH3138@twin.jikos.cz>
Date: Mon, 13 May 2019 19:47:07 +0200
From: David Sterba <dsterba@...e.cz>
To: "Tobin C. Harding" <tobin@...nel.org>
Cc: Chris Mason <clm@...com>, Josef Bacik <josef@...icpanda.com>,
David Sterba <dsterba@...e.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 0/2] Fix kobject error path memleaks
On Mon, May 13, 2019 at 01:39:10PM +1000, Tobin C. Harding wrote:
> Is it ok to send patches during the merge window?
Yes (depends on subsystem), the feedback for patches that are not fixes
could be delayed after the merge window closes.
> Applies on top of
> Linus' mainline tag: v5.1, happy to rebase if there are conflicts.
>
> While auditing kobject_init_and_add() calls throughout the kernel it was
> found that btrfs potentially has a couple of memleaks in the error path
> code for kobject_init_and_add().
>
> Failing calls to kobject_init_and_add() should be followed by a call to
> kobject_put() since kobject_init_and_add() always calls kobject_init().
>
> Of note, adding kobject_put() causes the release method to be called if
> kobject_init_and_add() fails. For patch #1 this means we don't have to
> manually free the space_info or call percpu_counter_destroy() since
> these are both done by the release method. In the second patch, I
> believe the added call to kobject_put() fits in with the fs_devices
> lifecycle assumptions of open_ctree() but please could you review since
> I am new to this code.
We use the cleanup-after-error pattern where it's up to the callee to
clean up, so it's right to do it like as you did. Patches added to the
queue that's for 5.2-rcX. Thanks.
Powered by blists - more mailing lists