[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200928115301.GB3987353@kuha.fi.intel.com>
Date: Mon, 28 Sep 2020 14:53:01 +0300
From: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: Christophe JAILLET <christophe.jaillet@...adoo.fr>, pavel@....cz,
dmurphy@...com, jacek.anaszewski@...il.com,
linux-leds@...r.kernel.org, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] leds: lp50xx: Fix an error handling path in
'lp50xx_probe_dt()'
On Thu, Sep 24, 2020 at 09:49:32AM +0300, Dan Carpenter wrote:
> On Wed, Sep 23, 2020 at 08:49:56PM +0200, Christophe JAILLET wrote:
> > Le 23/09/2020 à 15:35, Dan Carpenter a écrit :
> > > I've added Heikki Krogerus to the CC list because my question is mostly
> > > about commit 59abd83672f7 ("drivers: base: Introducing software nodes to
> > > the firmware node framework").
> > >
> > > I have been trying to teach Smatch to understand reference counting so
> > > it can discover these kinds of bugs automatically.
> > >
> > > I don't know how software_node_get_next_child() can work when it doesn't
> > > call kobject_get(). This sort of bug would have been caught in testing
> > > because it affects the success path so I must be reading the code wrong.
> > >
> >
> > I had the same reading of the code and thought that I was missing something
> > somewhere.
> >
> > There is the same question about 'acpi_get_next_subnode' which is also a
> > '.get_next_child_node' function, without any ref counting, if I'm correct.
> >
>
> Yeah, but there aren't any ->get/put() ops for the acpi_get_next_subnode()
> stuff so it's not a problem. (Presumably there is some other sort of
> refcounting policy there).
OK, so I guess we need to make software_node_get_next_child()
mimic the behaviour of of_get_next_available_child(), and not
acpi_get_next_subnode(). Does the attached patch work?
thanks,
--
heikki
View attachment "0001-software-nodes-Handle-the-refcounting-also-in-softwa.patch" of type "text/plain" (1767 bytes)
Powered by blists - more mailing lists