]> git.itanic.dy.fi Git - linux-stable/commit
clk: mediatek: fix double free in mtk_clk_register_pllfh()
authorDan Carpenter <dan.carpenter@linaro.org>
Tue, 24 Oct 2023 05:00:53 +0000 (08:00 +0300)
committerStephen Boyd <sboyd@kernel.org>
Tue, 24 Oct 2023 18:29:41 +0000 (11:29 -0700)
commitbd54ccc0f147019dac38e7841876a7415459b875
tree60d5268f3d27d85322d2c448b12d424defa794d4
parent0d6e24b422a2166a9297a8286ff2e6ab9a5e8cd3
clk: mediatek: fix double free in mtk_clk_register_pllfh()

The mtk_clk_register_pll_ops() currently frees the "pll" parameter.
The function has two callers, mtk_clk_register_pll() and
mtk_clk_register_pllfh().  The first one, the _pll() function relies on
the free, but for the second _pllfh() function it causes a double free
bug.

Really the frees should be done in the caller because that's where
the allocation is.

Fixes: d7964de8a8ea ("clk: mediatek: Add new clock driver to handle FHCTL hardware")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/cd7fa365-28cc-4c34-ac64-6da57c98baa6@moroto.mountain
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/mediatek/clk-pll.c