From: Ahmad Fatoum <[email protected]> bclk_register() crashes when ->name is NULL because __bclk_register() strdup()s it unconditionally. Reject such registrations early with -EINVAL instead of taking down the system, so a buggy driver only fails its own clock instead of the whole boot.
Signed-off-by: Ahmad Fatoum <[email protected]> Signed-off-by: Oleksij Rempel <[email protected]> --- drivers/clk/clk.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 5e385380cee2..99f995fb0224 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -494,6 +494,9 @@ int bclk_register(struct clk *clk) clk->parents = xzalloc(sizeof(struct clk *) * clk->num_parents); + if (!clk->name) + return -EINVAL; + ret = __bclk_register(clk); if (ret) free(clk->parents); -- 2.47.3
