1
linux/arch/powerpc
Julia Lawall a655237fa2 powerpc/irq.c: Add of_node_put to avoid memory leak
In this case, a device_node structure is stored in another structure that
is then freed without first decrementing the reference count of the
device_node structure.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r exists@
expression x;
identifier f;
position p1,p2;
@@

x@p1->f = \(of_find_node_by_path\|of_find_node_by_name\|of_find_node_by_phandle\|of_get_parent\|of_get_next_parent\|of_get_next_child\|of_find_compatible_node\|of_match_node\|of_find_node_by_type\|of_find_node_with_property\|of_find_matching_node\|of_parse_phandle\|of_node_get\)(...);
... when != of_node_put(x)
kfree@p2(x)

@script:python@
p1 << r.p1;
p2 << r.p2;
@@
cocci.print_main("call",p1)
cocci.print_secs("free",p2)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2010-10-13 16:19:04 +11:00
..
boot powerpc: Use static const char arrays 2010-10-13 16:19:03 +11:00
configs powerpc: Trim defconfigs 2010-08-09 11:19:16 +10:00
include/asm powerpc/pseries: Export rtas_ibm_suspend_me() 2010-10-13 16:19:02 +11:00
kernel powerpc/irq.c: Add of_node_put to avoid memory leak 2010-10-13 16:19:04 +11:00
kvm powerpc: Remove pr_<level> uses of KERN_<level> 2010-10-13 16:19:03 +11:00
lib powerpc: mtmsrd not defined 2010-09-02 14:07:34 +10:00
math-emu
mm powerpc/mm: Assume first cpu is boot_cpuid not 0 2010-09-02 14:07:34 +10:00
oprofile powerpc: Use is_32bit_task() helper to test 32-bit binary 2010-09-02 14:07:32 +10:00
platforms powerpc/pseries: Partition migration in the kernel 2010-10-13 16:19:03 +11:00
sysdev powerpc: Remove pr_<level> uses of KERN_<level> 2010-10-13 16:19:03 +11:00
xmon Input: sysrq - drop tty argument from sysrq ops handlers 2010-08-19 22:07:06 -07:00
Kconfig Merge branch 'timers-timekeeping-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2010-08-06 13:18:29 -07:00
Kconfig.debug
Makefile powerpc: Fix typo in uImage target 2010-08-24 15:26:32 +10:00
relocs_check.pl