diff options
| author | AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> | 2026-07-21 11:36:15 +0200 |
|---|---|---|
| committer | Stephen Boyd <sboyd@kernel.org> | 2026-10-14 20:03:18 -0700 |
| commit | f7aa9de4f2b197cdd704cdc476901b68ee128433 (patch) | |
| tree | 0e020b5458c96a855fb3c653f80532b2b668ef89 /tools/lib/python | |
| parent | 84c72fc05f73df3473b3bfac89c0a7eae765513a (diff) | |
spmi: Fix potential use-after-free by grabbing of_node reference
As noticed by Sashiko during a review run of an unrelated patch,
in of_spmi_register_devices(), for_each_available_child_of_node()
is used to loop through children, and to also assign a node to a
newly created SPMI child device.
Problem is that the refcount is dropped at every iteration so, in
the specific case of DT overlays, a use-after-free may occur when
an overlay is dynamically unloaded!
To resolve this, increase the of_node refcount when assigning (in
function of_spmi_register_devices) and release the reference in
spmi_device_remove().
Fixes: bc32bbd04011 ("spmi: Set fwnode for spmi devices")
Cc: stable@vger.kernel.org
Reported-by: Sashiko Bot <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/patchset/20260608100949.36309-1-angelogioacchino.delregno@collabora.com?part=2
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions
