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: <20210311170303.GB5031@lsv03152.swis.in-blr01.nxp.com>
Date:   Thu, 11 Mar 2021 22:33:03 +0530
From:   Calvin Johnson <calvin.johnson@....nxp.com>
To:     Andy Shevchenko <andy.shevchenko@...il.com>
Cc:     Grant Likely <grant.likely@....com>,
        "Rafael J . Wysocki" <rafael@...nel.org>,
        Jeremy Linton <jeremy.linton@....com>,
        Andrew Lunn <andrew@...n.ch>,
        Florian Fainelli <f.fainelli@...il.com>,
        Russell King - ARM Linux admin <linux@...linux.org.uk>,
        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>,
        linux-arm Mailing List <linux-arm-kernel@...ts.infradead.org>,
        Diana Madalina Craciun <diana.craciun@....com>,
        ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        "linux.cj" <linux.cj@...il.com>, netdev <netdev@...r.kernel.org>,
        Laurentiu Tudor <laurentiu.tudor@....com>,
        "David S. Miller" <davem@...emloft.net>,
        Heiner Kallweit <hkallweit1@...il.com>,
        Jakub Kicinski <kuba@...nel.org>
Subject: Re: [net-next PATCH v7 07/16] net: mii_timestamper: check NULL in
 unregister_mii_timestamper()

On Thu, Mar 11, 2021 at 02:04:48PM +0200, Andy Shevchenko wrote:
> On Thu, Mar 11, 2021 at 8:21 AM Calvin Johnson
> <calvin.johnson@....nxp.com> wrote:
> >
> > Callers of unregister_mii_timestamper() currently check for NULL
> > value of mii_ts before calling it.
> >
> > Place the NULL check inside unregister_mii_timestamper() and update
> > the callers accordingly
> 
> FWIW,
> Reviewed-by: Andy Shevchenko <andy.shevchenko@...il.com>
> 
> (Don't remember if it has been suggested by somebody, in that case
> perhaps Suggested-by?)

It is the result of your suggestion[1]. So, I'll keep both Suggested-by and
Reviewed-by with your name.

[1] https://lore.kernel.org/linux-arm-kernel/20210218052654.28995-1-calvin.johnson@oss.nxp.com/T/#m8d209f08f97fe1dc7249a63ad97b39311d14a9b3

Thanks
Calvin

> 
> > Signed-off-by: Calvin Johnson <calvin.johnson@....nxp.com>
> > ---
> >
> > Changes in v7:
> > - check NULL in unregister_mii_timestamper()
> >
> > Changes in v6: None
> > Changes in v5: None
> > Changes in v4: None
> > Changes in v3: None
> > Changes in v2: None
> >
> >  drivers/net/mdio/of_mdio.c        | 6 ++----
> >  drivers/net/phy/mii_timestamper.c | 3 +++
> >  drivers/net/phy/phy_device.c      | 3 +--
> >  3 files changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/net/mdio/of_mdio.c b/drivers/net/mdio/of_mdio.c
> > index 612a37970f14..48b6b8458c17 100644
> > --- a/drivers/net/mdio/of_mdio.c
> > +++ b/drivers/net/mdio/of_mdio.c
> > @@ -115,15 +115,13 @@ static int of_mdiobus_register_phy(struct mii_bus *mdio,
> >         else
> >                 phy = get_phy_device(mdio, addr, is_c45);
> >         if (IS_ERR(phy)) {
> > -               if (mii_ts)
> > -                       unregister_mii_timestamper(mii_ts);
> > +               unregister_mii_timestamper(mii_ts);
> >                 return PTR_ERR(phy);
> >         }
> >
> >         rc = of_mdiobus_phy_device_register(mdio, phy, child, addr);
> >         if (rc) {
> > -               if (mii_ts)
> > -                       unregister_mii_timestamper(mii_ts);
> > +               unregister_mii_timestamper(mii_ts);
> >                 phy_device_free(phy);
> >                 return rc;
> >         }
> > diff --git a/drivers/net/phy/mii_timestamper.c b/drivers/net/phy/mii_timestamper.c
> > index b71b7456462d..51ae0593a04f 100644
> > --- a/drivers/net/phy/mii_timestamper.c
> > +++ b/drivers/net/phy/mii_timestamper.c
> > @@ -111,6 +111,9 @@ void unregister_mii_timestamper(struct mii_timestamper *mii_ts)
> >         struct mii_timestamping_desc *desc;
> >         struct list_head *this;
> >
> > +       if (!mii_ts)
> > +               return;
> > +
> >         /* mii_timestamper statically registered by the PHY driver won't use the
> >          * register_mii_timestamper() and thus don't have ->device set. Don't
> >          * try to unregister these.
> > diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> > index f875efe7b4d1..9c5127405d91 100644
> > --- a/drivers/net/phy/phy_device.c
> > +++ b/drivers/net/phy/phy_device.c
> > @@ -928,8 +928,7 @@ EXPORT_SYMBOL(phy_device_register);
> >   */
> >  void phy_device_remove(struct phy_device *phydev)
> >  {
> > -       if (phydev->mii_ts)
> > -               unregister_mii_timestamper(phydev->mii_ts);
> > +       unregister_mii_timestamper(phydev->mii_ts);
> >
> >         device_del(&phydev->mdio.dev);
> >
> > --
> > 2.17.1
> >
> 
> 
> -- 
> With Best Regards,
> Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ