1
0
Fork 0
alistair23-linux/drivers/of
Erhard Furtner 4c45e9ed24 of: unittest: fix memory leak in attach_node_and_children
[ Upstream commit 2aacace6db ]

In attach_node_and_children memory is allocated for full_name via
kasprintf. If the condition of the 1st if is not met the function
returns early without freeing the memory. Add a kfree() to fix that.

This has been detected with kmemleak:
Link: https://bugzilla.kernel.org/show_bug.cgi?id=205327

It looks like the leak was introduced by this commit:
Fixes: 5babefb7f7 ("of: unittest: allow base devicetree to have symbol metadata")

Signed-off-by: Erhard Furtner <erhard_f@mailbox.org>
Reviewed-by: Michael Ellerman <mpe@ellerman.id.au>
Reviewed-by: Tyrel Datwyler <tyreld@linux.ibm.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-01-04 19:18:25 +01:00
..
unittest-data of: overlay: check prevents multiple fragments touching same property 2018-11-08 22:12:03 -08:00
Kconfig dma-mapping: improve selection of dma_declare_coherent availability 2019-02-20 07:26:35 -07:00
Makefile PCI: Move OF-related PCI functions into PCI core 2018-01-17 17:36:39 -06:00
address.c of: address: Add support for the parent DMA bus 2019-04-10 16:33:47 -05:00
base.c of: restore old handling of cells_name=NULL in of_*_phandle_with_args() 2019-09-19 08:33:02 -05:00
device.c of/device.c: fix the wrong comments 2019-05-01 13:41:07 -05:00
dynamic.c of: Remove struct device_node.type pointer 2019-01-10 16:24:44 -06:00
fdt.c fdt: Update CRC check for rng-seed 2019-08-27 12:27:07 +01:00
fdt_address.c of: Use SPDX license tag for DT files 2018-01-08 08:22:45 -06:00
irq.c of: irq: fix a trivial typo in a doc comment 2019-08-14 20:12:16 -06:00
kobj.c of: overlay: add missing of_node_get() in __of_attach_node_sysfs 2018-11-08 22:10:53 -08:00
of_mdio.c of: mdio: Fix a signedness bug in of_phy_get_and_connect() 2019-09-27 10:19:09 +02:00
of_net.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 428 2019-06-05 17:37:16 +02:00
of_numa.c of, numa: Validate some distance map rules 2018-11-08 12:44:34 -06:00
of_private.h of: __of_detach_node() - remove node from phandle cache 2018-12-21 12:42:36 -06:00
of_reserved_mem.c of: reserved_mem: add missing of_node_put() for proper ref-counting 2019-10-23 15:15:05 -05:00
overlay.c of: Remove struct device_node.type pointer 2019-01-10 16:24:44 -06:00
pdt.c of: Remove struct device_node.type pointer 2019-01-10 16:24:44 -06:00
platform.c drivers: Introduce device lookup variants by of_node 2019-07-30 13:07:41 +02:00
property.c of: property: Document that of_graph_get_endpoint_by_regs needs of_node_put 2019-04-10 09:03:03 -05:00
resolver.c of: resolver: Add of_node_put() before return and break 2019-08-12 16:52:24 -06:00
unittest.c of: unittest: fix memory leak in attach_node_and_children 2020-01-04 19:18:25 +01:00