]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
of: overlay: add_changeset_property() memory leak
authorFrank Rowand <frank.rowand@sony.com>
Thu, 21 Nov 2019 19:16:56 +0000 (13:16 -0600)
committerMarcelo Henrique Cerri <marcelo.cerri@canonical.com>
Fri, 17 Jan 2020 17:23:06 +0000 (14:23 -0300)
commit721d7d76b57e9970c5895b737ac16d0ff75a176c
tree7df8286fab2e3c69f48c1dd320c11b5b018c371f
parent424c012e89707afc33e847c7453eddb67d2dccfa
of: overlay: add_changeset_property() memory leak

BugLink: https://bugs.launchpad.net/bugs/1857158
[ Upstream commit 637392a8506a3a7dd24ab9094a14f7522adb73b4 ]

No changeset entries are created for #address-cells and #size-cells
properties, but the duplicated properties are never freed.  This
results in a memory leak which is detected by kmemleak:

 unreferenced object 0x85887180 (size 64):
   backtrace:
     kmem_cache_alloc_trace+0x1fb/0x1fc
     __of_prop_dup+0x25/0x7c
     add_changeset_property+0x17f/0x370
     build_changeset_next_level+0x29/0x20c
     of_overlay_fdt_apply+0x32b/0x6b4
     ...

Fixes: 6f75118800ac ("of: overlay: validate overlay properties #address-cells and #size-cells")
Reported-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
Signed-off-by: Frank Rowand <frank.rowand@sony.com>
Tested-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/of/overlay.c