linux_dsm_epyc7002/drivers/net/fs_enet
Julia Lawall e8f7f43a4a drivers/net/fs_enet/fs_enet-main.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>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-09-06 18:29:17 -07:00
..
fec.h [PATCH] FS_ENET: use PAL for mii management 2006-08-19 17:44:31 -04:00
fs_enet-main.c drivers/net/fs_enet/fs_enet-main.c: Add of_node_put to avoid memory leak 2010-09-06 18:29:17 -07:00
fs_enet.h fs_enet: Add support for MPC512x to fs_enet driver 2010-02-27 02:34:35 -08:00
Kconfig fs_enet: Add support for MPC512x to fs_enet driver 2010-02-27 02:34:35 -08:00
mac-fcc.c of/device: Replace struct of_device with struct platform_device 2010-08-06 09:25:50 -06:00
mac-fec.c of/device: Replace struct of_device with struct platform_device 2010-08-06 09:25:50 -06:00
mac-scc.c of/device: Replace struct of_device with struct platform_device 2010-08-06 09:25:50 -06:00
Makefile fs_enet: Remove !CONFIG_PPC_CPM_NEW_BINDING code 2008-07-16 17:57:49 -05:00
mii-bitbang.c of/device: Replace struct of_device with struct platform_device 2010-08-06 09:25:50 -06:00
mii-fec.c of/device: Replace struct of_device with struct platform_device 2010-08-06 09:25:50 -06:00