[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200108104438.yp4nva3yjlwlh7ey@vireshk-i7>
Date: Wed, 8 Jan 2020 16:14:38 +0530
From: Viresh Kumar <viresh.kumar@...aro.org>
To: Michał Mirosław <mirq-linux@...e.qmqm.pl>
Cc: Nishanth Menon <nm@...com>, Stephen Boyd <sboyd@...nel.org>,
linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] opp: fix of_node leak for unsupported entries
On 08-01-20, 11:38, Michał Mirosław wrote:
> On Wed, Jan 08, 2020 at 01:03:38PM +0530, Viresh Kumar wrote:
> > On 07-01-20, 15:04, Michał Mirosław wrote:
> > > On Tue, Jan 07, 2020 at 12:06:16PM +0530, Viresh Kumar wrote:
> > > > Discard my earlier reply, it wasn't accurate/correct.
> > > >
> > > > On 03-01-20, 20:36, Michał Mirosław wrote:
> > > > > When parsing OPP v2 table, unsupported entries return NULL from
> > > > > _opp_add_static_v2().
> > > >
> > > > Right, as we don't want parsing to fail here.
> > > >
> > > > > In this case node reference is leaked.
> > > >
> > > > Why do you think so ?
> > >
> > > for_each_available_child_of_node() returns nodes with refcount
> > > increased
> >
> > I believe it also drops the refcount of the previous node everytime the loop
> > goes to the next element. Else we would be required do that from within that
> > loop itself, isn't it ?
>
> Indeed it is! This means that _opp_add_static_v2() is storing a pointer
> to a node without taking a reference to it. Is there something else that
> guarantees the node won't disappear later?
We do store them, but don't use them other than comparing the value of
the pointer itself which is harmless.
--
viresh
Powered by blists - more mailing lists