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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230804135102.u3i6lz2bjhh3p2rn@skbuf>
Date:   Fri, 4 Aug 2023 16:51:02 +0300
From:   Vladimir Oltean <vladimir.oltean@....com>
To:     Eric Dumazet <edumazet@...gle.com>
Cc:     netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>, Andrew Lunn <andrew@...n.ch>,
        Florian Fainelli <f.fainelli@...il.com>,
        Maxim Georgiev <glipus@...il.com>,
        Horatiu Vultur <horatiu.vultur@...rochip.com>,
        Köry Maincent <kory.maincent@...tlin.com>,
        Maxime Chevallier <maxime.chevallier@...tlin.com>,
        Richard Cochran <richardcochran@...il.com>,
        Vadim Fedorenko <vadim.fedorenko@...ux.dev>,
        Gerhard Engleder <gerhard@...leder-embedded.com>,
        Hangbin Liu <liuhangbin@...il.com>,
        Russell King <linux@...linux.org.uk>,
        Heiner Kallweit <hkallweit1@...il.com>,
        Jacob Keller <jacob.e.keller@...el.com>,
        Jay Vosburgh <j.vosburgh@...il.com>,
        Andy Gospodarek <andy@...yhouse.net>,
        Wei Fang <wei.fang@....com>,
        Shenwei Wang <shenwei.wang@....com>,
        Clark Wang <xiaoning.wang@....com>,
        NXP Linux Team <linux-imx@....com>,
        UNGLinuxDriver@...rochip.com,
        Lars Povlsen <lars.povlsen@...rochip.com>,
        Steen Hegelund <Steen.Hegelund@...rochip.com>,
        Daniel Machon <daniel.machon@...rochip.com>,
        Simon Horman <simon.horman@...igine.com>,
        Casper Andersson <casper.casan@...il.com>,
        Sergey Organov <sorganov@...il.com>,
        Michal Kubecek <mkubecek@...e.cz>,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v9 net-next 12/12] net: remove phy_has_hwtstamp() ->
 phy_mii_ioctl() decision from converted drivers

On Fri, Aug 04, 2023 at 09:21:28AM +0200, Eric Dumazet wrote:
> > +/**
> > + * dev_set_hwtstamp_phylib() - Change hardware timestamping of NIC
> > + *     or of attached phylib PHY
> > + * @dev: Network device
> > + * @cfg: Timestamping configuration structure
> > + * @extack: Netlink extended ack message structure, for error reporting
> > + *
> > + * Helper for enforcing a common policy that phylib timestamping, if available,
> > + * should take precedence in front of hardware timestamping provided by the
> > + * netdev. If the netdev driver needs to perform specific actions even for PHY
> > + * timestamping to work properly (a switch port must trap the timestamped
> > + * frames and not forward them), it must set IFF_SEE_ALL_HWTSTAMP_REQUESTS in
> > + * dev->priv_flags.
> > + */
> > +static int dev_set_hwtstamp_phylib(struct net_device *dev,
> > +                                  struct kernel_hwtstamp_config *cfg,
> > +                                  struct netlink_ext_ack *extack)
> > +{
> > +       const struct net_device_ops *ops = dev->netdev_ops;
> > +       bool phy_ts = phy_has_hwtstamp(dev->phydev);
> > +       struct kernel_hwtstamp_config old_cfg = {};
> > +       bool changed = false;
> > +       int err;
> > +
> > +       cfg->source = phy_ts ? HWTSTAMP_SOURCE_PHYLIB : HWTSTAMP_SOURCE_NETDEV;
> > +
> > +       if (!phy_ts || (dev->priv_flags & IFF_SEE_ALL_HWTSTAMP_REQUESTS)) {
> > +               err = ops->ndo_hwtstamp_get(dev, &old_cfg);
> 
> old_cfg.ifr is NULL at this point.
> 
> This causes a crash later in generic_hwtstamp_ioctl_lower()
> 
>     ifrr.ifr_ifru = kernel_cfg->ifr->ifr_ifru;

Thanks for reporting. My control flow is all wrong, it seems. I've sent
this patch for addressing the breakage:

https://lore.kernel.org/netdev/20230804134939.3109763-1-vladimir.oltean@nxp.com/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ