Re: [PATCH 2/3] soc: samsung: exynos-pmu: fix use-after-free of interrupt generator node
From: Alexey Klimov
Date: Wed Jul 15 2026 - 14:46:42 EST
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 <alexey.klimov@xxxxxxxxxx> 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/c866dbcd-c211-48df-84e3-f66785ba8538@xxxxxxxxxx/
I'll update it.
Best regards,
Alexey