| Message ID | 20260115031114.220888-3-chiffathefoxx@gmail.com |
|---|---|
| State | New |
| Delegated to: | Tom Rini |
| Headers | show |
| Series | Improvements to the recent clock rework by marex. | expand |
On 2026-01-15 05:11 +02:00, chiffathefox wrote: > 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 <chiffathefoxx@gmail.com> Tested-by: Kaustabh Chakraborty <kauschluss@disroot.org> # exynos-mobile/exynos7870
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; }
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 <chiffathefoxx@gmail.com> --- drivers/clk/exynos/clk.c | 1 - 1 file changed, 1 deletion(-)