From: Vincent Whitchurch <vincent.whitchurch@axis.com>
To: pantelis.antoniou@konsulko.com, frowand.list@gmail.com,
robh+dt@kernel.org
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
Vincent Whitchurch <rabinv@axis.com>
Subject: [PATCH 2/2] of: overlay: fix target_path memory leak
Date: Mon, 18 Nov 2019 14:28:09 +0100 [thread overview]
Message-ID: <20191118132809.30127-2-vincent.whitchurch@axis.com> (raw)
In-Reply-To: <20191118132809.30127-1-vincent.whitchurch@axis.com>
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:
--
2.20.0
next prev parent reply other threads:[~2019-11-18 13:28 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 ` Vincent Whitchurch [this message]
2019-11-21 17:37 ` [PATCH 2/2] of: overlay: fix target_path " Frank Rowand
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=20191118132809.30127-2-vincent.whitchurch@axis.com \
--to=vincent.whitchurch@axis.com \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pantelis.antoniou@konsulko.com \
--cc=rabinv@axis.com \
--cc=robh+dt@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;
as well as URLs for NNTP newsgroup(s).