[PATCH 1/2] clk: bcm2835: aux: Fix potential use-after-free on unbind
Guangshuo Li
liguangshuo at mail.sdu.edu.cn
Sat Nov 28 01:44:35 PST 2026
The OF clock provider remains registered when the driver is unbound,
although its onecell data is released by devres. A later clock lookup
can access that freed data.
Manage the provider so it is removed before its data is released.
This issue was found by our static analysis tool under development.
Fixes: 5e63dcc74b30 ("clk: bcm2835: Add a driver for the auxiliary peripheral clock gates.")
Signed-off-by: Guangshuo Li <liguangshuo at mail.sdu.edu.cn>
---
drivers/clk/bcm/clk-bcm2835-aux.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/clk/bcm/clk-bcm2835-aux.c b/drivers/clk/bcm/clk-bcm2835-aux.c
index 351a63e5cdfc..0b0bb35f3f84 100644
--- a/drivers/clk/bcm/clk-bcm2835-aux.c
+++ b/drivers/clk/bcm/clk-bcm2835-aux.c
@@ -45,8 +45,7 @@ static int bcm2835_aux_clk_probe(struct platform_device *pdev)
onecell->hws[BCM2835_AUX_CLOCK_SPI2] =
clk_hw_register_gate(dev, "aux_spi2", parent, 0, gate, 2, 0, NULL);
- return of_clk_add_hw_provider(pdev->dev.of_node, of_clk_hw_onecell_get,
- onecell);
+ return devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, onecell);
}
static const struct of_device_id bcm2835_aux_clk_of_match[] = {
--
2.43.0
More information about the linux-arm-kernel
mailing list