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: <CAHp75VdSLb7bnd4v52wYD8KfqcDxjkirBgJVEYMWo=cwdeLzsg@mail.gmail.com>
Date:   Mon, 1 Jun 2020 17:08:40 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Johan Hovold <johan@...nel.org>
Cc:     Jacek Anaszewski <jacek.anaszewski@...il.com>,
        Pavel Machek <pavel@....cz>, Dan Murphy <dmurphy@...com>,
        Amitoj Kaur Chawla <amitoj1606@...il.com>,
        Linux LED Subsystem <linux-leds@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 0/6] leds: fix broken devres usage

On Mon, Jun 1, 2020 at 5:01 PM Johan Hovold <johan@...nel.org> wrote:
>
> On Mon, Jun 01, 2020 at 04:51:01PM +0300, Andy Shevchenko wrote:
> > On Mon, Jun 1, 2020 at 4:42 PM Johan Hovold <johan@...nel.org> wrote:
> > >
> > > Several MFD child drivers register their class devices directly under
> > > the parent device (about half of the MFD LED drivers do so).
> > >
> > > This means you cannot blindly do devres conversions so that
> > > deregistration ends up being tied to the parent device, something which
> > > leads to use-after-free on driver unbind when the class device is
> > > released while still being registered (and, for example, oopses on later
> > > parent MFD driver unbind or LED class callbacks, or resource leaks and
> > > name clashes on child driver reload).
> >
> > Shouldn't MFD take reference count for their children?
>
> That's not the issue here. The child driver is allocating memory for the
> class device (for example using devres), and that will end up being
> freed on unbind while said device is still registered. The child driver
> may then even be unloaded. No extra reference can fix this.

Okay, I didn't still get how dropping devres will help here.

Say, we have

->probe()
{
 return devm_foo_register();
}

and no ->remove()

vs.

->probe()
{
  return foo_register();
}

->remove()
{
 foo_unregister();
}

So, basically what you seem to workaround is that ->remove() is not
getting called?

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ