mips: cdmm: Fix refcount leak in mips_cdmm_phys_base
Subsystems (2)
PATCH 1/1 mips: cdmm: Fix refcount leak in mips_cdmm_phys_base
The of_find_compatible_node() function returns a node pointer with refcount incremented, We should use of_node_put() on it when done Add the missing of_node_put() to release the refcount.
Fixes 2121aa3e2312 ("mips: cdmm: Add mti,mips-cdmm dtb node support")
Signed-off-by Miaoqian Lin <[email protected]>
--- drivers/bus/mips_cdmm.c | 1 + 1 file changed, 1 insertion(+)
drivers/bus/mips_cdmm.c +1 -0
@@ -351,6 +351,7 @@ phys_addr_t __weak mips_cdmm_phys_base(void) np =of_find_compatible_node (NULL ,NULL ,"mti,mips-cdmm" );if (np) { err =of_address_to_resource (np,0 , &res); +of_node_put (np);if (!err)return res.start; }
Signature · 1 line
2.17.1
Quoted 5 lines · Miaoqian Lin
The
of_find_compatible_node()function returns a node pointer with refcount incremented, We should useof_node_put()on it when done Add the missingof_node_put()to release the refcount.Fixes 2121aa3e2312 ("mips: cdmm: Add mti,mips-cdmm dtb node support")
Nice catch. Thanks.
Acked-by Serge Semin <[email protected]>
Quoted 20 lines
Signed-off-by Miaoqian Lin <[email protected]>--- drivers/bus/mips_cdmm.c | 1 + 1 file changed, 1 insertion(+)drivers/bus/mips_cdmm.c +1
-0@@ -351,6 +351,7 @@ phys_addr_t __weak mips_cdmm_phys_base(void) np =of_find_compatible_node (NULL ,NULL ,"mti,mips-cdmm" );if (np) { err =of_address_to_resource (np,0 , &res); +of_node_put (np);if (!err)return res.start; }Signature · 1 line
2.17.1
Quoted 9 lines · Miaoqian Lin
The
of_find_compatible_node()function returns a node pointer with refcount incremented, We should useof_node_put()on it when done Add the missingof_node_put()to release the refcount.Fixes 2121aa3e2312 ("mips: cdmm: Add mti,mips-cdmm dtb node support")Signed-off-by Miaoqian Lin <[email protected]>--- drivers/bus/mips_cdmm.c | 1 + 1 file changed, 1 insertion(+)
applied to mips-next.
Thomas.
Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]