From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] nvmem: core: Fix a resource leak on error in nvmem_add_cells_from_of()
Date: Tue, 5 Jan 2021 16:23:37 +0000 [thread overview]
Message-ID: <83c3536c-424a-46fb-5fdc-993b1bbb1490@linaro.org> (raw)
In-Reply-To: <X93cOvjVvzfig1Pu@mwanda>
On 19/12/2020 10:55, Dan Carpenter wrote:
> This doesn't call of_node_put() on the error path so it leads to a
> memory leak.
>
> Fixes: 0749aa25af82 ("nvmem: core: fix regression in of_nvmem_cell_get()")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied, thanks
--srini
> ---
> The kfree_const() could just be replaced with kfree(). Someone got over
> excited converting things from kfree() to kfree_const().
>
> drivers/nvmem/core.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
> index 177f5bf27c6d..68ae6f24b57f 100644
> --- a/drivers/nvmem/core.c
> +++ b/drivers/nvmem/core.c
> @@ -713,6 +713,7 @@ static int nvmem_add_cells_from_of(struct nvmem_device *nvmem)
> cell->name, nvmem->stride);
> /* Cells already added will be freed later. */
> kfree_const(cell->name);
> + of_node_put(cell->np);
> kfree(cell);
> return -EINVAL;
> }
>
prev parent reply other threads:[~2021-01-05 16:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-19 10:55 Dan Carpenter
2021-01-05 16:23 ` Srinivas Kandagatla [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83c3536c-424a-46fb-5fdc-993b1bbb1490@linaro.org \
--to=srinivas.kandagatla@linaro.org \
--cc=dan.carpenter@oracle.com \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®