В ядре Linux была устранена следующая уязвимость: spmi: Fix potential use-after-free путём захвата of_node reference As, замеченного Sashiko во время выполнения обзора несвязанного патча, в of_spmi_register_devices(), for_each_available_child_of_node() используется для петли через детей, а также для назначения узла вновь созданному дочернему устройству SPMI. Проблема в том, что пересчет отбрасывается на каждой итерации, поэтому в конкретном случае наложений DT может возникнуть use-after-free, когда наложение динамически разгружается! Чтобы решить эту проблему, увеличьте пересчет of_node при назначении (в функции of_spmi_register_devices) и выпустите ссылку в spmi_device_remove().
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: 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().