[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <877egew2ur.fsf@concordia.ellerman.id.au>
Date: Thu, 13 Dec 2018 13:57:16 +1100
From: Michael Ellerman <mpe@...erman.id.au>
To: Frank Rowand <frowand.list@...il.com>,
Rob Herring <robh+dt@...nel.org>
Cc: mwb@...ux.vnet.ibm.com,
linuxppc-dev <linuxppc-dev@...ts.ozlabs.org>,
Tyrel Datwyler <tyreld@...ux.vnet.ibm.com>,
tlfalcon@...ux.vnet.ibm.com, minkim@...ibm.com,
devicetree@...r.kernel.org,
"linux-kernel\@vger.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v03] powerpc/mobility: Fix node detach/rename problem
Frank Rowand <frowand.list@...il.com> writes:
> On 12/11/18 8:07 AM, Rob Herring wrote:
>> On Tue, Dec 11, 2018 at 7:29 AM Michael Ellerman <mpe@...erman.id.au> wrote:
...
>>> diff --git a/drivers/of/base.c b/drivers/of/base.c
>>> index 09692c9b32a7..d8e4534c0686 100644
>>> --- a/drivers/of/base.c
>>> +++ b/drivers/of/base.c
>>> @@ -1190,6 +1190,10 @@ struct device_node *of_find_node_by_phandle(phandle handle)
>>> if (phandle_cache[masked_handle] &&
>>> handle == phandle_cache[masked_handle]->phandle)
>>> np = phandle_cache[masked_handle];
>>> +
>>> + /* If we find a detached node, remove it */
>>> + if (of_node_check_flag(np, OF_DETACHED))
>>> + np = phandle_cache[masked_handle] = NULL;
>
> The bug you found exposes a couple of different issues, a little bit
> deeper than the proposed fix. I'll work on a fuller fix tonight or
> tomorrow.
OK thanks.
>> I'm wondering if we should explicitly remove the node from the cache
>> when we set OF_DETACHED. Otherwise, it could be possible that the node
>> pointer has been freed already. Or maybe we need both?
>
> Yes, it should be explicitly removed. I may also add in a paranoia check in
> of_find_node_by_phandle().
That seems best to me.
cheers
Powered by blists - more mailing lists