Re: [PATCH] arch: x86: kernel: Add missing of_node_put() in devicetree.c

From: Rob Herring
Date: Wed Jun 15 2022 - 12:22:30 EST


On Wed, Jun 15, 2022 at 9:33 AM Dave Hansen <dave.hansen@xxxxxxxxx> wrote:
>
> On 6/15/22 08:03, Liang He wrote:
> > In dtb_setup_hpet(), of_find_compatible_node() will return a node
> > pointer with refcount incremented. We should use of_node_put() when it
> > is not used anymore.
> >
> > Signed-off-by: Liang He <windhl@xxxxxxx>
>
> Seems like:
>
> Fixes: ffb9fc68dff3 ("x86: dtb: Add device tree support for HPET")
>
> and would be appropriate, right?
>
> Also, how was this found, and what is the impact from not fixing it?

No impact if the node is not dynamically removed. That's almost all
cases except IBM pSeries cpu, memory, and pci. Overlays could change
that, but their support in the kernel is limited.

If it really mattered, we'd probably come up with a different way to
do the refcounting as it is hard to get right. In fact, this fix is
not right. Will reply with the right context.

> Was it causing horrible problems in production, or was it just something
> that was found by inspection that's not causing any real problems in
> practice?