Commit 0cc15a1
regulator: core: Protect regulator_supply_alias_list with regulator_list_mutex
regulator_supply_alias_list was accessed without any locking in
regulator_supply_alias(), regulator_register_supply_alias(), and
regulator_unregister_supply_alias(). Concurrent registration,
unregistration and lookups can race, leading to:
1 use-after-free if an alias entry is removed while being read,
2 duplicate entries when two threads register the same alias,
3 inconsistent alias mappings observed by consumers.
Protect all traversals, insertions and deletions on
regulator_supply_alias_list with the existing regulator_list_mutex.
Fixes: a06ccd9 ("regulator: core: Add ability to create a lookup alias for supply")
Signed-off-by: sparkhuang <huangshaobo3@xiaomi.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20251127025716.5440-1-huangshaobo3@xiaomi.com
Signed-off-by: Mark Brown <broonie@kernel.org>1 parent c67bb84 commit 0cc15a1
1 file changed
Lines changed: 20 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2058 | 2058 | | |
2059 | 2059 | | |
2060 | 2060 | | |
| 2061 | + | |
2061 | 2062 | | |
2062 | 2063 | | |
2063 | 2064 | | |
| |||
2066 | 2067 | | |
2067 | 2068 | | |
2068 | 2069 | | |
| 2070 | + | |
2069 | 2071 | | |
2070 | 2072 | | |
2071 | 2073 | | |
| |||
2618 | 2620 | | |
2619 | 2621 | | |
2620 | 2622 | | |
| 2623 | + | |
2621 | 2624 | | |
2622 | | - | |
2623 | | - | |
2624 | | - | |
2625 | | - | |
2626 | | - | |
2627 | | - | |
| 2625 | + | |
| 2626 | + | |
2628 | 2627 | | |
2629 | 2628 | | |
2630 | | - | |
2631 | | - | |
2632 | | - | |
2633 | | - | |
2634 | | - | |
2635 | | - | |
| 2629 | + | |
| 2630 | + | |
| 2631 | + | |
| 2632 | + | |
| 2633 | + | |
| 2634 | + | |
| 2635 | + | |
2636 | 2636 | | |
| 2637 | + | |
| 2638 | + | |
| 2639 | + | |
| 2640 | + | |
| 2641 | + | |
| 2642 | + | |
2637 | 2643 | | |
2638 | 2644 | | |
2639 | 2645 | | |
| |||
2653 | 2659 | | |
2654 | 2660 | | |
2655 | 2661 | | |
| 2662 | + | |
2656 | 2663 | | |
2657 | 2664 | | |
2658 | 2665 | | |
2659 | 2666 | | |
2660 | 2667 | | |
| 2668 | + | |
2661 | 2669 | | |
2662 | 2670 | | |
2663 | 2671 | | |
| |||
0 commit comments