From: Frank Rowand <frowand.list@gmail.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Rob Herring <robh@kernel.org>
Cc: devicetree@vger.kernel.org,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Michael Ellerman <mpe@ellerman.id.au>,
Segher Boessenkool <segher@kernel.crashing.org>,
Frank Rowand <frowand.list@gmail.com>
Subject: Re: [PATCH] of: Rework and simplify phandle cache to use a fixed size
Date: Thu, 19 Dec 2019 09:33:00 -0600 [thread overview]
Message-ID: <eaf5e27b-696f-bede-520c-cf6a847a5250@gmail.com> (raw)
In-Reply-To: <20191212130539.loxpr2hbfcodh4gz@linutronix.de>
On 12/12/19 7:05 AM, Sebastian Andrzej Siewior wrote:
> On 2019-12-11 17:48:54 [-0600], Rob Herring wrote:
>>> - if (phandle_cache) {
>>> - if (phandle_cache[masked_handle] &&
>>> - handle == phandle_cache[masked_handle]->phandle)
>>> - np = phandle_cache[masked_handle];
>>> - if (np && of_node_check_flag(np, OF_DETACHED)) {
>>> - WARN_ON(1); /* did not uncache np on node removal */
>>> - of_node_put(np);
>>> - phandle_cache[masked_handle] = NULL;
>>> - np = NULL;
>>> - }
>>> + if (phandle_cache[handle_hash] &&
>>> + handle == phandle_cache[handle_hash]->phandle)
>>> + np = phandle_cache[handle_hash];
>>> + if (np && of_node_check_flag(np, OF_DETACHED)) {
>>> + WARN_ON(1); /* did not uncache np on node removal */
>>
>> BTW, I don't think this check is even valid. If we failed to detach
>> and remove the node from the cache, then we could be accessing np
>> after freeing it.
>
> this is kmalloc()ed memory which is always valid. If the memory is
It was kmalloc()ed memory _before_ applying Rob's patch. It no longer
is kmalloc()ed, so the rest of this discussion no longer applies.
-Frank
> already re-used then
> handle == phandle_cache[handle_hash]->phandle
>
> will fail (the check, not the memory access itself). If the check
> remains valid then you can hope for the OF_DETACHED flag to trigger the
> warning.
>
>> Rob
>
> Sebastian
>
next prev parent reply other threads:[~2019-12-19 15:33 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-11 23:23 [PATCH] of: Rework and simplify phandle cache to use a fixed size Rob Herring
2019-12-11 23:48 ` Rob Herring
2019-12-12 13:05 ` Sebastian Andrzej Siewior
2019-12-12 19:28 ` Rob Herring
2019-12-18 9:47 ` Sebastian Andrzej Siewior
2019-12-19 15:33 ` Frank Rowand [this message]
2019-12-19 15:31 ` Frank Rowand
2019-12-12 11:50 ` Frank Rowand
2019-12-19 3:38 ` Frank Rowand
2019-12-12 13:00 ` Sebastian Andrzej Siewior
2019-12-19 15:51 ` Frank Rowand
2020-01-07 10:22 ` Jon Hunter
2020-01-10 23:50 ` Rob Herring
2020-01-13 11:12 ` Jon Hunter
2020-04-14 15:00 ` Rob Herring
2020-04-14 19:43 ` Jon Hunter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=eaf5e27b-696f-bede-520c-cf6a847a5250@gmail.com \
--to=frowand.list@gmail.com \
--cc=bigeasy@linutronix.de \
--cc=devicetree@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mpe@ellerman.id.au \
--cc=robh@kernel.org \
--cc=segher@kernel.crashing.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).