[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191118132809.30127-2-vincent.whitchurch@axis.com>
Date: Mon, 18 Nov 2019 14:28:09 +0100
From: Vincent Whitchurch <vincent.whitchurch@...s.com>
To: pantelis.antoniou@...sulko.com, frowand.list@...il.com,
robh+dt@...nel.org
Cc: devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
Vincent Whitchurch <rabinv@...s.com>
Subject: [PATCH 2/2] of: overlay: fix target_path memory leak
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@...s.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
Powered by blists - more mailing lists