lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGETcx8d0KR3BeLxa6eKr_QkNgg=+dcq18tAu2A5M6W9pMFOHw@mail.gmail.com>
Date:   Tue, 31 Aug 2021 23:57:45 -0700
From:   Saravana Kannan <saravanak@...gle.com>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     "Rafael J. Wysocki" <rafael@...nel.org>,
        Ulf Hansson <ulf.hansson@...aro.org>,
        Marek Szyprowski <m.szyprowski@...sung.com>,
        kernel-team@...roid.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1] driver core: fw_devlink: Don't create device links for
 devices not on a bus

On Tue, Aug 31, 2021 at 11:24 PM Greg Kroah-Hartman
<gregkh@...uxfoundation.org> wrote:
>
> On Tue, Aug 31, 2021 at 03:45:10PM -0700, Saravana Kannan wrote:
> > Devices that are not on a bus will never have a driver bound to it. So,
> > fw_devlink should not create device links for it as it can cause probe
> > issues[1] or sync_state() call back issues[2].
> >
> > [1] - https://lore.kernel.org/lkml/CAGETcx_xJCqOWtwZ9Ee2+0sPGNLM5=F=djtbdYENkAYZa0ynqQ@mail.gmail.com/
> > [2] - https://lore.kernel.org/lkml/CAPDyKFo9Bxremkb1dDrr4OcXSpE0keVze94Cm=zrkOVxHHxBmQ@mail.gmail.com/
> > Fixes: f9aa460672c9 ("driver core: Refactor fw_devlink feature")
> > Reported-by: Ulf Hansson <ulf.hansson@...aro.org>
> > Reported-by: Marek Szyprowski <m.szyprowski@...sung.com>
> > Signed-off-by: Saravana Kannan <saravanak@...gle.com>
> > ---
> >  drivers/base/core.c | 16 ++++++++++++++++
> >  1 file changed, 16 insertions(+)
> >
> > diff --git a/drivers/base/core.c b/drivers/base/core.c
> > index f6360490a4a3..304a06314656 100644
> > --- a/drivers/base/core.c
> > +++ b/drivers/base/core.c
> > @@ -1719,8 +1719,24 @@ static int fw_devlink_create_devlink(struct device *con,
> >       struct device *sup_dev;
> >       int ret = 0;
> >
> > +     /*
> > +      * If a consumer device is not on a bus (i.e. a driver will never bind
> > +      * to it), it doesn't make sense for fw_devlink to create device links
> > +      * for it.
> > +      */
> > +     if (con->bus == NULL)
> > +             return -EINVAL;
> > +
>
> Why would a device not be on a bus that has to do with a driver needing
> it?  What types of devices are these?

I'm not sure what you are asking, because it seems like a question
you'd know the answer to. What I'm trying to say is that
bus_probe_device() is obviously only possible if the device is on a
bus. And fw_devlink creates managed device links that track if a
device is bound to a driver. So it doesn't make sense to create the
device link if the device is not on a bus.

There are plenty of examples for this -- like all the devices that get
added to a class? For example the platform bus or the mdio bus itself
are devices that are added to a class instead of a bus.

Not sure if I answered your question. Let me know.

-Saravana

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ