All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] of: dynamic: fix memory leak related to properties of __of_node_dup
@ 2017-10-13  1:42 ` alawang
  0 siblings, 0 replies; 25+ messages in thread
From: alawang @ 2017-10-13  1:42 UTC (permalink / raw)
  To: Rob Herring, Frank Rowand
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, alawang

It is possible a node was dynamically allocated but without any
property. The properies will be got from devices and added to the
node when devices got connected.
When release this node, all properties of which had been moved to
deadprops.
In this case, the properties in the deadprops list are never
deallocated.

Signed-off-by: alawang <alan.1.wang-FTnzSCDXTkYjo0HpFSRKWA@public.gmane.org>
---
 drivers/of/dynamic.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c
index 301b6db..465d43b 100644
--- a/drivers/of/dynamic.c
+++ b/drivers/of/dynamic.c
@@ -335,6 +335,10 @@ void of_node_release(struct kobject *kobj)
 	if (!of_node_check_flag(node, OF_DYNAMIC))
 		return;
 
+	if (!prop) {
+		prop = node->deadprops;
+		node->deadprops = NULL;
+	}
 	while (prop) {
 		struct property *next = prop->next;
 		kfree(prop->name);
-- 
2.6.2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2017-10-23 16:47 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-13  1:42 [PATCH] of: dynamic: fix memory leak related to properties of __of_node_dup alawang
2017-10-13  1:42 ` alawang
     [not found] ` <1507858967-40416-1-git-send-email-alan.1.wang-FTnzSCDXTkYjo0HpFSRKWA@public.gmane.org>
2017-10-13  3:25   ` Lixin Wang
2017-10-13  3:25     ` Lixin Wang
2017-10-13 20:47   ` Rob Herring
2017-10-13 20:47     ` Rob Herring
2017-10-14  0:59     ` Frank Rowand
2017-10-16  4:35       ` Wang, Alan 1. (NSB - CN/Hangzhou)
     [not found]       ` <59E1615F.50901-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-17 14:03         ` Rob Herring
2017-10-17 14:03           ` Rob Herring
2017-10-20  1:59   ` [PATCH v4] " Lixin Wang
2017-10-20  1:59     ` Lixin Wang
     [not found]     ` <1508464749-54218-1-git-send-email-alan.1.wang-FTnzSCDXTkYjo0HpFSRKWA@public.gmane.org>
2017-10-20 18:12       ` Rob Herring
2017-10-20 18:12         ` Rob Herring
2017-10-17  4:20 ` [PATCH v2] " Lixin Wang
2017-10-17  4:20   ` Lixin Wang
2017-10-19  9:40 ` [PATCH v3] " Lixin Wang
2017-10-19  9:40   ` Lixin Wang
2017-10-19 23:26   ` Frank Rowand
     [not found]     ` <59E934A1.9060304-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-19 23:34       ` frowand.list-Re5JQEeQqe8AvxtiuMwx3w
2017-10-19 23:34         ` frowand.list
2017-10-23  3:19 ` [PATCH v5] " Lixin Wang
2017-10-23  3:19   ` Lixin Wang
2017-10-23  5:16   ` Frank Rowand
2017-10-23 16:47     ` Rob Herring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.