]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
clk: imx: scu: use _safe list iterator to avoid a use after free
authorDan Carpenter <dan.carpenter@linaro.org>
Wed, 19 Apr 2023 14:23:01 +0000 (17:23 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Jul 2023 17:39:35 +0000 (19:39 +0200)
commit3d90921f91fc6a8c801d527bb5848c99e335c1cf
treeff389e1b491f0f330fe5ad48bbe501f7514ba4e8
parent79d8c176310b2f20f51726cedd17ebe25a222d97
clk: imx: scu: use _safe list iterator to avoid a use after free

[ Upstream commit 632c60ecd25dbacee54d5581fe3aeb834b57010a ]

This loop is freeing "clk" so it needs to use list_for_each_entry_safe().
Otherwise it dereferences a freed variable to get the next item on the
loop.

Fixes: 77d8f3068c63 ("clk: imx: scu: add two cells binding support")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Abel Vesa <abel.vesa@linaro.org>
Link: https://lore.kernel.org/r/0793fbd1-d2b5-4ec2-9403-3c39343a3e2d@kili.mountain
Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/clk/imx/clk-scu.c