lkml.org 
[lkml]   [2017]   [Oct]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] of: dynamic: fix memory leak related to properties of __of_node_dup
On Thu, Oct 12, 2017 at 8:42 PM, alawang <alan.1.wang@nokia-sbell.com> wrote:
> 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.

This is not new, right? Do you actually hit this case? If so, how?

>
> Signed-off-by: alawang <alan.1.wang@nokia-sbell.com>
> ---
> 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@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html

\
 
 \ /
  Last update: 2017-10-13 22:47    [W:0.218 / U:0.688 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site