All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frank Rowand <frowand.list@gmail.com>
To: Vincent Whitchurch <vincent.whitchurch@axis.com>,
	pantelis.antoniou@konsulko.com, robh+dt@kernel.org
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Vincent Whitchurch <rabinv@axis.com>
Subject: Re: [PATCH 2/2] of: overlay: fix target_path memory leak
Date: Thu, 21 Nov 2019 11:37:15 -0600	[thread overview]
Message-ID: <b916ab0e-bb60-1476-b321-e931645df688@gmail.com> (raw)
In-Reply-To: <20191118132809.30127-2-vincent.whitchurch@axis.com>

Hi Rob,

On 11/18/19 7:28 AM, Vincent Whitchurch wrote:
> target_path is used as a temporary buffer in dup_and_fixup_symbol_prop()
> and should be freed even in the success path.
> 
> This was detected by kmemleak.
> 
>  unreferenced object 0x8598f6c0 (size 64):
>    backtrace:
>      __kmalloc_track_caller+0x17d/0x228
>      kvasprintf+0x2b/0x64
>      kasprintf+0x15/0x20
>      add_changeset_property+0x225/0x364
>      of_overlay_fdt_apply+0x42d/0x6b4
>      ...
> 
> Fixes: e0a58f3e08d4b7fa ("of: overlay: remove a dependency on device node full_name")
> Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
> ---
>  drivers/of/overlay.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
> index 5f8869e2a8b3..59455322a130 100644
> --- a/drivers/of/overlay.c
> +++ b/drivers/of/overlay.c
> @@ -261,6 +261,8 @@ static struct property *dup_and_fixup_symbol_prop(
>  
>  	of_property_set_flag(new_prop, OF_DYNAMIC);
>  
> +	kfree(target_path);
> +
>  	return new_prop;
>  
>  err_free_new_prop:
> 

Reviewed-by: Frank Rowand <frowand.list@gmail.com>

I would suggest changing the subject to:

   of: overlay: dup_and_fixup_symbol_prop() memory leak

but I am also fine with you not changing the subject.

-Frank

  reply	other threads:[~2019-11-21 17:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-18 13:28 [PATCH 1/2] of: overlay: fix properties memory leak Vincent Whitchurch
2019-11-18 13:28 ` [PATCH 2/2] of: overlay: fix target_path " Vincent Whitchurch
2019-11-21 17:37   ` Frank Rowand [this message]
2019-11-21 16:55 ` [PATCH 1/2] of: overlay: fix properties " Frank Rowand

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=b916ab0e-bb60-1476-b321-e931645df688@gmail.com \
    --to=frowand.list@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pantelis.antoniou@konsulko.com \
    --cc=rabinv@axis.com \
    --cc=robh+dt@kernel.org \
    --cc=vincent.whitchurch@axis.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.