Skip to content

Commit eb9e9bc

Browse files
windhltsbogend
authored andcommitted
mips/pic32/pic32mzda: Fix refcount leak bugs
of_find_matching_node(), of_find_compatible_node() and of_find_node_by_path() will return node pointers with refcout incremented. We should call of_node_put() when they are not used anymore. Signed-off-by: Liang He <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
1 parent 7669559 commit eb9e9bc

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

arch/mips/pic32/pic32mzda/init.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,18 @@ static int __init pic32_of_prepare_platform_data(struct of_dev_auxdata *lookup)
9898
np = of_find_compatible_node(NULL, NULL, lookup->compatible);
9999
if (np) {
100100
lookup->name = (char *)np->name;
101-
if (lookup->phys_addr)
101+
if (lookup->phys_addr) {
102+
of_node_put(np);
102103
continue;
104+
}
103105
if (!of_address_to_resource(np, 0, &res))
104106
lookup->phys_addr = res.start;
107+
of_node_put(np);
105108
}
106109
}
107110

111+
of_node_put(root);
112+
108113
return 0;
109114
}
110115

arch/mips/pic32/pic32mzda/time.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ static unsigned int pic32_xlate_core_timer_irq(void)
3232
goto default_map;
3333

3434
irq = irq_of_parse_and_map(node, 0);
35+
36+
of_node_put(node);
37+
3538
if (!irq)
3639
goto default_map;
3740

0 commit comments

Comments
 (0)