Commit 4a6756f
reset: Fix crash when freeing non-existent optional resets
When obtaining one or more optional resets, non-existent resets are
stored as NULL pointers, and all related error and cleanup paths need to
take this into account.
Currently only reset_control_put() and reset_control_bulk_put()
get this right. All of __reset_control_bulk_get(),
of_reset_control_array_get(), and reset_control_array_put() lack the
proper checking, causing NULL pointer dereferences on failure or
release.
Fix this by moving the existing check from reset_control_bulk_put() to
__reset_control_put_internal(), so it applies to all callers.
The double check in reset_control_put() doesn't hurt.
Fixes: 17c82e2 ("reset: Add APIs to manage array of resets")
Fixes: 48d7139 ("reset: Add reset_control_bulk API")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/2440edae7ca8534628cdbaf559ded288f2998178.1701276806.git.geert+renesas@glider.be
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>1 parent b5ec294 commit 4a6756f
1 file changed
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
807 | 807 | | |
808 | 808 | | |
809 | 809 | | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
810 | 813 | | |
811 | 814 | | |
812 | 815 | | |
| |||
1017 | 1020 | | |
1018 | 1021 | | |
1019 | 1022 | | |
1020 | | - | |
1021 | | - | |
1022 | | - | |
| 1023 | + | |
1023 | 1024 | | |
1024 | | - | |
1025 | 1025 | | |
1026 | 1026 | | |
1027 | 1027 | | |
| |||
0 commit comments