diff mbox series

clk: versatile: clk-icst: use after free on error path

Message ID 20211117072604.GC5237@kili (mailing list archive)
State Accepted, archived
Headers show
Series clk: versatile: clk-icst: use after free on error path | expand

Commit Message

Dan Carpenter Nov. 17, 2021, 7:26 a.m. UTC
This frees "name" and then tries to display in as part of the error
message on the next line.  Swap the order.

Fixes: 1b2189f3aa50 ("clk: versatile: clk-icst: Ensure clock names are unique")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/clk/versatile/clk-icst.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Linus Walleij Nov. 21, 2021, 11:37 p.m. UTC | #1
On Wed, Nov 17, 2021 at 8:26 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:

> This frees "name" and then tries to display in as part of the error
> message on the next line.  Swap the order.
>
> Fixes: 1b2189f3aa50 ("clk: versatile: clk-icst: Ensure clock names are unique")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij
Stephen Boyd Dec. 7, 2021, 8:24 p.m. UTC | #2
Quoting Dan Carpenter (2021-11-16 23:26:05)
> This frees "name" and then tries to display in as part of the error
> message on the next line.  Swap the order.
> 
> Fixes: 1b2189f3aa50 ("clk: versatile: clk-icst: Ensure clock names are unique")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---

Applied to clk-next
Stephen Boyd Dec. 7, 2021, 8:25 p.m. UTC | #3
Quoting Dan Carpenter (2021-11-16 23:26:05)
> This frees "name" and then tries to display in as part of the error
> message on the next line.  Swap the order.
> 
> Fixes: 1b2189f3aa50 ("clk: versatile: clk-icst: Ensure clock names are unique")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---

Actually, applied to clk-fixes
diff mbox series

Patch

diff --git a/drivers/clk/versatile/clk-icst.c b/drivers/clk/versatile/clk-icst.c
index d52f976dc875..d5cb372f0901 100644
--- a/drivers/clk/versatile/clk-icst.c
+++ b/drivers/clk/versatile/clk-icst.c
@@ -543,8 +543,8 @@  static void __init of_syscon_icst_setup(struct device_node *np)
 
 	regclk = icst_clk_setup(NULL, &icst_desc, name, parent_name, map, ctype);
 	if (IS_ERR(regclk)) {
-		kfree(name);
 		pr_err("error setting up syscon ICST clock %s\n", name);
+		kfree(name);
 		return;
 	}
 	of_clk_add_provider(np, of_clk_src_simple_get, regclk);