]> git.baikalelectronics.ru Git - 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)
committerRob Herring <robh@kernel.org>
Tue, 26 Nov 2019 19:32:21 +0000 (12:32 -0700)
commitfe3f67956fe24099b5249802cd29354014b8054a
tree5d3ce04e265c153c4db9273a4a9c9ecbbd2c10ec
parent0a0a62a658620455c142e1ede60ec6fbb37d9832
of: overlay: add_changeset_property() memory leak

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: 190a3cbf0e8c ("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>
drivers/of/overlay.c