Commit ceb87a3
clk: Sanitize possible_parent_show to Handle Return Value of of_clk_get_parent_name
In the possible_parent_show function, ensure proper handling of the return
value from of_clk_get_parent_name to prevent potential issues arising from
a NULL return.
The current implementation invokes seq_puts directly on the result of
of_clk_get_parent_name without verifying the return value, which can lead
to kernel panic if the function returns NULL.
This patch addresses the concern by introducing a check on the return
value of of_clk_get_parent_name. If the return value is not NULL, the
function proceeds to call seq_puts, providing the returned value as
argument.
However, if of_clk_get_parent_name returns NULL, the function provides a
static string as argument, avoiding the panic.
Fixes: 1ccc0dd ("clk: Use seq_puts() in possible_parent_show()")
Reported-by: Philip Daly <[email protected]>
Signed-off-by: Alessandro Carminati (Red Hat) <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Stephen Boyd <[email protected]>1 parent 601cb6d commit ceb87a3
1 file changed
+12
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3416 | 3416 | | |
3417 | 3417 | | |
3418 | 3418 | | |
| 3419 | + | |
3419 | 3420 | | |
3420 | 3421 | | |
3421 | 3422 | | |
| |||
3430 | 3431 | | |
3431 | 3432 | | |
3432 | 3433 | | |
3433 | | - | |
| 3434 | + | |
3434 | 3435 | | |
3435 | | - | |
| 3436 | + | |
3436 | 3437 | | |
3437 | | - | |
| 3438 | + | |
3438 | 3439 | | |
3439 | | - | |
3440 | | - | |
3441 | | - | |
3442 | | - | |
3443 | | - | |
3444 | | - | |
| 3440 | + | |
| 3441 | + | |
| 3442 | + | |
| 3443 | + | |
| 3444 | + | |
| 3445 | + | |
| 3446 | + | |
| 3447 | + | |
3445 | 3448 | | |
3446 | 3449 | | |
3447 | 3450 | | |
| |||
0 commit comments