It would appear the original developer of this driver
reparented child clock devices to fix the issue described in
`clk: clk_resolve_parent_clk(): resolve external clocks by id`.
This hacky fix was the cause of invalid memory access when calling
clk_get_rate() on a clock retrieved via clk_get_by_index().
clk_get_by_index() returns a copy of the `struct clk` and
when passed to clk_get_rate() it may be forwarded to
clk_divider_recalc_rate(), which will cause the latter to
run container_of() on a pointer from caller's stack instead
of the pointer that was kzalloc()'d by the clk-divider driver.

Signed-off-by: chiffathefox <[email protected]>
---

 drivers/clk/exynos/clk.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/clk/exynos/clk.c b/drivers/clk/exynos/clk.c
index a2c9f4851da..aa4d4112db7 100644
--- a/drivers/clk/exynos/clk.c
+++ b/drivers/clk/exynos/clk.c
@@ -19,7 +19,6 @@ int samsung_clk_request(struct clk *clk)
        if (ret)
                return ret;
 
-       clk->dev = c->dev;
        return 0;
 }
 
-- 
2.34.1

Reply via email to