[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <652883fe10d38_780ef29459@dwillia2-xfh.jf.intel.com.notmuch>
Date: Thu, 12 Oct 2023 16:40:46 -0700
From: Dan Williams <dan.j.williams@...el.com>
To: Michal Wilczynski <michal.wilczynski@...el.com>,
<linux-acpi@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<nvdimm@...ts.linux.dev>
CC: <rafael.j.wysocki@...el.com>, <andriy.shevchenko@...el.com>,
<lenb@...nel.org>, <dan.j.williams@...el.com>,
<vishal.l.verma@...el.com>, <ira.weiny@...el.com>,
Michal Wilczynski <michal.wilczynski@...el.com>,
"Andy Shevchenko" <andy.shevchenko@...il.com>
Subject: RE: [PATCH v1 1/2] ACPI: NFIT: Fix memory leak, and local use of
devm_*()
Michal Wilczynski wrote:
> devm_*() family of functions purpose is managing memory attached to a
> device. So in general it should only be used for allocations that should
> last for the whole lifecycle of the device. This is not the case for
> acpi_nfit_init_interleave_set(). There are two allocations that are only
> used locally in this function. What's more - if the function exits on
> error path memory is never freed. It's still attached to dev and would
> be freed on device detach, so this leak could be called a 'local leak'.
This analysis is incorrect devm cleans up on driver ->probe() failure in
addition to ->remove(), and these error returns result in ->probe()
failures. No leak, i.e. this is not a fix.
The conversion to modern probe is ok if you want to resubmit that one
without this intervening change.
Powered by blists - more mailing lists