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] [day] [month] [year] [list]
Date:   Thu, 21 Nov 2019 09:40:13 +0100
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     David Bauer <mail@...id-bauer.net>
Cc:     Andrew Lunn <andrew@...n.ch>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Marek BehĂșn <marek.behun@....cz>,
        Dmitry Torokhov <dmitry.torokhov@...il.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        Sergei Shtylyov <sergei.shtylyov@...entembedded.com>,
        netdev <netdev@...r.kernel.org>,
        Linux-Renesas <linux-renesas-soc@...r.kernel.org>
Subject: Re: [PATCH net 1/1] mdio_bus: fix mdio_register_device when
 RESET_CONTROLLER is disabled

Hi David,

On Thu, Nov 21, 2019 at 9:38 AM David Bauer <mail@...id-bauer.net> wrote:
> On 11/21/19 3:08 AM, Andrew Lunn wrote:
> >> The difference with the non-optional case is that
> >> __devm_reset_control_get() registers a cleanup function if there's
> >> no error condition, even for NULL (which is futile, will send a patch).
> >>
> >> However, more importantly, mdiobus_register_reset() calls a devm_*()
> >> function on "&mdiodev->dev" ("mdio_bus ee700000.ethernet-ffffffff:01"),
> >> which is a different device than the one being probed
> >> (("ee700000.ethernet"), see also the callstack below).
> >> In fact "&mdiodev->dev" hasn't been probed yet, leading to the WARNING
> >> when it is probed later.
> >>
> >>     [<c0582de8>] (mdiobus_register_device) from [<c05810e0>] (phy_device_register+0xc/0x74)
> >>     [<c05810e0>] (phy_device_register) from [<c0675ef4>] (of_mdiobus_register_phy+0x144/0x17c)
> >>     [<c0675ef4>] (of_mdiobus_register_phy) from [<c06760f0>] (of_mdiobus_register+0x1c4/0x2d0)
> >>     [<c06760f0>] (of_mdiobus_register) from [<c0589f0c>] (sh_eth_drv_probe+0x778/0x8ac)
> >>     [<c0589f0c>] (sh_eth_drv_probe) from [<c0516ce8>] (platform_drv_probe+0x48/0x94)
> >>
> >> Has commit 71dd6c0dff51b5f1 ("net: phy: add support for
> >> reset-controller") been tested with an actual reset present?
>
> I'm using it on a AR9132 board, however the mdio bus is probed before the
> ethernet driver, hence why i was not experiencing this misbehavior.

Thank you, that explains it.

> >> Are Ethernet drivers not (no longer) allowed to register MDIO busses?
> >
> > That is not good. The devm_reset_control_get() call need replaces with
> > an unmanaged version, and a call to reset_control_put() added to
> > mdiobus_unregister_device().
> >
> > David, could you look at this, it was a patch from you that added
> > this.
>
> I will prepare patches to fix this bug.

Thanks!

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists