memory: pl353-smc: Fix refcount leak bug in pl353_smc_probe()
Subsystems (2)
PATCH 1/1 memory: pl353-smc: Fix refcount leak bug in pl353_smc_probe()
The break of for_each_available_child_of_node() needs a correpsonding of_node_put() when the reference 'child'is not used anymore. Here we do not need to call of_node_put() in fail path as '!match' means no break.
While the of_platform_device_create() will created a new reference by 'child' but it has considered the refcounting.
--- drivers/memory/pl353-smc.c | 1 + 1 file changed, 1 insertion(+)
drivers/memory/pl353-smc.c +1 -0
@@ -122,6 +122,7 @@ static int pl353_smc_probe(struct amba_device *adev, const struct amba_id *id) }of_platform_device_create (child,NULL , &adev->dev); +of_node_put (child);return 0 ;
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 2 lines · Liang He
The break of
for_each_available_child_of_node()needs a correpsondingof_node_put()when the reference 'child'is not
Applied with typo fixes. It's late in the cycle though, but I will try to squeeze it into v5.20.
Best regards,
Krzysztof
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Krzysztof Kozlowski
AppliedQuoted 9 lines · Liang He
The break of
for_each_available_child_of_node()needs a correpsondingof_node_put()when the reference 'child'is not used anymore. Here we do not need to callof_node_put()in fail path as '!match' means no break.While the
of_platform_device_create()will created a new reference by 'child' but it has considered the refcounting.[...]
Applied, thanks!
[1/1] memory: pl353-smc: Fix refcount leak bug in pl353_smc_probe()
https://git.kernel.org/krzk/linux-mem-ctrl/c/2d68c320aa14e5b494de698ce70ca6e6db40bc4b
Best regards,
Signature · 6 lines
Krzysztof Kozlowski <[email protected]> _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel