Skip to contentSkip to conversation

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

PATCH Applied Dan Carpenter 3 participants 4 messages Nov 17, 2021 – Dec 7, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: versatile: clk-icst: use after free on error path

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")
---
 drivers/clk/versatile/clk-icst.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/versatile/clk-icst.c +1 -1
index d52f976dc875..d5cb372f0901 100644
@@ -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);
Signature · 1 line
2.20.1
maintainer Applied
#2 lore raw
In reply to Dan Carpenter

Quoting Dan Carpenter (2021-11-16 23:26:05)

Quoted 6 lines

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")

---

Applied to clk-next

maintainer
#3 lore raw
In reply to Dan Carpenter

Quoting Dan Carpenter (2021-11-16 23:26:05)

Quoted 6 lines

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")

---

Actually, applied to clk-fixes