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: <20210215123309.GA5067@lsv03152.swis.in-blr01.nxp.com>
Date:   Mon, 15 Feb 2021 18:03:09 +0530
From:   Calvin Johnson <calvin.johnson@....nxp.com>
To:     Russell King - ARM Linux admin <linux@...linux.org.uk>
Cc:     Grant Likely <grant.likely@....com>,
        "Rafael J . Wysocki" <rafael@...nel.org>,
        Jeremy Linton <jeremy.linton@....com>,
        Andrew Lunn <andrew@...n.ch>,
        Andy Shevchenko <andy.shevchenko@...il.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        Cristi Sovaiala <cristian.sovaiala@....com>,
        Florin Laurentiu Chiculita <florinlaurentiu.chiculita@....com>,
        Ioana Ciornei <ioana.ciornei@....com>,
        Madalin Bucur <madalin.bucur@....nxp.com>,
        Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
        Marcin Wojtas <mw@...ihalf.com>,
        Pieter Jansen Van Vuuren <pieter.jansenvv@...boosystems.io>,
        Jon <jon@...id-run.com>, Saravana Kannan <saravanak@...gle.com>,
        Randy Dunlap <rdunlap@...radead.org>,
        Laurentiu Tudor <laurentiu.tudor@....com>,
        linux-kernel@...r.kernel.org, linux.cj@...il.com,
        Diana Madalina Craciun <diana.craciun@....com>,
        netdev@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-acpi@...r.kernel.org,
        "David S. Miller" <davem@...emloft.net>,
        Ioana Radulescu <ruxandra.radulescu@....com>,
        Jakub Kicinski <kuba@...nel.org>
Subject: Re: [net-next PATCH v5 15/15] net: dpaa2-mac: Add ACPI support for
 DPAA2 MAC driver

On Mon, Feb 08, 2021 at 04:28:31PM +0000, Russell King - ARM Linux admin wrote:
> On Mon, Feb 08, 2021 at 08:42:44PM +0530, Calvin Johnson wrote:
> > Modify dpaa2_mac_connect() to support ACPI along with DT.
> > Modify dpaa2_mac_get_node() to get the dpmac fwnode from either
> > DT or ACPI.
> > 
> > Replace of_get_phy_mode with fwnode_get_phy_mode to get
> > phy-mode for a dpmac_node.
> > 
> > Use helper function phylink_fwnode_phy_connect() to find phy_dev and
> > connect to mac->phylink.
> > 
> > Signed-off-by: Calvin Johnson <calvin.johnson@....nxp.com>
> 
> I don't think this does the full job.
> 
> >  static int dpaa2_pcs_create(struct dpaa2_mac *mac,
> > -			    struct device_node *dpmac_node, int id)
> > +			    struct fwnode_handle *dpmac_node,
> > +			    int id)
> >  {
> >  	struct mdio_device *mdiodev;
> > -	struct device_node *node;
> > +	struct fwnode_handle *node;
> >  
> > -	node = of_parse_phandle(dpmac_node, "pcs-handle", 0);
> > -	if (!node) {
> > +	node = fwnode_find_reference(dpmac_node, "pcs-handle", 0);
> > +	if (IS_ERR(node)) {
> >  		/* do not error out on old DTS files */
> >  		netdev_warn(mac->net_dev, "pcs-handle node not found\n");
> >  		return 0;
> >  	}
> >  
> > -	if (!of_device_is_available(node)) {
> > +	if (!of_device_is_available(to_of_node(node))) {
> 
> If "node" is an ACPI node, then to_of_node() returns NULL, and
> of_device_is_available(NULL) is false. So, if we're using ACPI
> and we enter this path, we will always hit the error below:
> 
> >  		netdev_err(mac->net_dev, "pcs-handle node not available\n");
> > -		of_node_put(node);
> > +		of_node_put(to_of_node(node));
> >  		return -ENODEV;
> >  	}
> 
> > @@ -306,7 +321,7 @@ int dpaa2_mac_connect(struct dpaa2_mac *mac)
> >  	 * error out if the interface mode requests them and there is no PHY
> >  	 * to act upon them
> >  	 */
> > -	if (of_phy_is_fixed_link(dpmac_node) &&
> > +	if (of_phy_is_fixed_link(to_of_node(dpmac_node)) &&
> 
> If "dpmac_node" is an ACPI node, to_of_node() will return NULL, and
> of_phy_is_fixed_link() will oops.

I think of_phy_is_fixed_link() needs to be fixed. I'll add below fix.

--- a/drivers/net/mdio/of_mdio.c
+++ b/drivers/net/mdio/of_mdio.c
@@ -439,6 +439,9 @@ bool of_phy_is_fixed_link(struct device_node *np)
        int len, err;
        const char *managed;

+       if (!np)
+               return false;
+
        /* New binding */
        dn = of_get_child_by_name(np, "fixed-link");
        if (dn) {

Regards
Calvin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ