Re: [PATCH 2/3] soc: samsung: exynos-pmu: fix use-after-free of interrupt generator node

"Alexey Klimov" <[email protected]> Wed, 15 Jul 2026 19:46:01 +0100
Newsgroups org.kernel.vger.linux-samsung-soc,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel,org.kernel.vger.stable
Message-ID <[email protected]>
On Wed Jun 10, 2026 at 11:58 AM BST, Peter Griffin wrote:
> Hi Alexey,

Hi Peter,

> Thanks for your patch.
>
> On Fri, 5 Jun 2026 at 21:19, Alexey Klimov <[email protected]> wrote:
>>
>> The setup_cpuhp_and_cpuidle() parses the device tree node for the
>> interrupt generation block via of_parse_phandle() and decrements its
>> reference count using of_node_put() immediately after fetching the resource
>> address. However, later the intr_gen_node pointer is passed into
>> of_syscon_register_regmap().
>>
>> Fix this by moving the of_node_put() invocation to after the
>> of_syscon_register_regmap() call, and adding it to correct error paths.
>
> I think  using
> __free(device_node) = of_parse_phandle
>
> would be a cleaner/simpler fix.

Yep, thanks. Around time of sending this Krzysztof also adviced to use
_free() in another commit on maillist.

https://lore.kernel.org/linux-samsung-soc/[email protected]/

I'll update it.

Best regards,
Alexey