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: <YXBk8gwuCqrxDbVY@lunn.ch>
Date:   Wed, 20 Oct 2021 20:50:26 +0200
From:   Andrew Lunn <andrew@...n.ch>
To:     Matthias Schiffer <matthias.schiffer@...tq-group.com>
Cc:     Joakim Zhang <qiangqing.zhang@....com>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: fec: defer probe if PHY on external MDIO bus is not
 available

> > I've not looked at the details yet, just back from vacation. But this
> > seems wrong. I would of expected phylib to of returned -EPRODE_DEFER
> > at some point, when asked for a PHY which does not exist yet. All the
> > driver should need to do is make sure it returns the
> > -EPRODE_DEFER.
> 
> This is what I expected as well, however there are a few complications:
> 
> - At the moment the first time the driver does anything with the PHY is
>   in fec_enet_open(), not in fec_probe() - way too late to defer
>   anything

O.K. Right. Are you using NFS root? For normal user space opening of
the interface, this has all been sorted out by the time user space
does anything. The NFS root changes the time in a big way.

Anyway, i would say some bits of code need moving from open to probe
so EPROBE_DEFER can be used.

We already have:

        phy_node = of_parse_phandle(np, "phy-handle", 0);
        if (!phy_node && of_phy_is_fixed_link(np)) {
                ret = of_phy_register_fixed_link(np);
                if (ret < 0) {
                        dev_err(&pdev->dev,
                                "broken fixed-link specification\n");
                        goto failed_phy;
                }
                phy_node = of_node_get(np);
        }
        fep->phy_node = phy_node;

Go one step further. If fep->phy_node is not NULL, we know there
should be a PHY. So call of_phy_find_device(). If it returns NULL,
then -EPROBE_DEFER. Otherwise store the phydev into fep, and use it in
open.

You will need to move the call to fec_enet_mii_init(pdev) earlier, so
the MDIO bus is available.

    Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ