mirror of
https://github.com/raspberrypi/linux.git
synced 2026-01-04 18:27:36 +00:00
lib/genalloc: fix device leak in of_gen_pool_get()
commit1260cbcffaupstream. Make sure to drop the reference taken when looking up the genpool platform device in of_gen_pool_get() before returning the pool. Note that holding a reference to a device does typically not prevent its devres managed resources from being released so there is no point in keeping the reference. Link: https://lkml.kernel.org/r/20250924080207.18006-1-johan@kernel.org Fixes:9375db07ad("genalloc: add devres support, allow to find a managed pool by device") Signed-off-by: Johan Hovold <johan@kernel.org> Cc: Philipp Zabel <p.zabel@pengutronix.de> Cc: Vladimir Zapolskiy <vz@mleia.com> Cc: <stable@vger.kernel.org> [3.10+] Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
8f4abe676e
commit
00d9c4a822
@@ -899,8 +899,11 @@ struct gen_pool *of_gen_pool_get(struct device_node *np,
|
|||||||
if (!name)
|
if (!name)
|
||||||
name = of_node_full_name(np_pool);
|
name = of_node_full_name(np_pool);
|
||||||
}
|
}
|
||||||
if (pdev)
|
if (pdev) {
|
||||||
pool = gen_pool_get(&pdev->dev, name);
|
pool = gen_pool_get(&pdev->dev, name);
|
||||||
|
put_device(&pdev->dev);
|
||||||
|
}
|
||||||
|
|
||||||
of_node_put(np_pool);
|
of_node_put(np_pool);
|
||||||
|
|
||||||
return pool;
|
return pool;
|
||||||
|
|||||||
Reference in New Issue
Block a user