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]
Message-ID: <ZDPA1GG7Rgfhu/DP@Laptop-X1>
Date:   Mon, 10 Apr 2023 15:55:00 +0800
From:   Hangbin Liu <liuhangbin@...il.com>
To:     Eric Dumazet <edumazet@...gle.com>
Cc:     netdev@...r.kernel.org, Jay Vosburgh <j.vosburgh@...il.com>,
        "David S . Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Jonathan Toppins <jtoppins@...hat.com>,
        Paolo Abeni <pabeni@...hat.com>, Liang Li <liali@...hat.com>,
        Miroslav Lichvar <mlichvar@...hat.com>
Subject: Re: [PATCHv2 net-next] bonding: add software tx timestamping support

On Fri, Apr 07, 2023 at 11:34:23AM +0200, Eric Dumazet wrote:
> > diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> > index 00646aa315c3..994efc777a77 100644
> > --- a/drivers/net/bonding/bond_main.c
> > +++ b/drivers/net/bonding/bond_main.c
> > @@ -5686,9 +5686,13 @@ static int bond_ethtool_get_ts_info(struct net_device *bond_dev,
> >                                     struct ethtool_ts_info *info)
> >  {
> >         struct bonding *bond = netdev_priv(bond_dev);
> > +       struct ethtool_ts_info ts_info;
> >         const struct ethtool_ops *ops;
> >         struct net_device *real_dev;
> >         struct phy_device *phydev;
> > +       bool soft_support = false;
> > +       struct list_head *iter;
> > +       struct slave *slave;
> >         int ret = 0;
> >
> >         rcu_read_lock();
> > @@ -5707,10 +5711,41 @@ static int bond_ethtool_get_ts_info(struct net_device *bond_dev,
> >                         ret = ops->get_ts_info(real_dev, info);
> >                         goto out;
> >                 }
> > +       } else {
> > +               /* Check if all slaves support software rx/tx timestamping */
> > +               rcu_read_lock();
> > +               bond_for_each_slave_rcu(bond, slave, iter) {
> > +                       ret = -1;
> > +                       dev_hold(slave->dev);
> 
> You are holding rcu_read_lock() during the loop, so there is no need
> for this dev_hold() / dev_put() dance.

Thanks, I will remove this part.

> 
> And if this was needed, we kindly ask for new dev_hold()/dev_put()
> added in networking code to
> instead use netdev_hold / netdev_put(), we have spent enough time
> tracking hold/put bugs.

I saw dev_hold has called netdev_hold. Is there a need to convert the
old dev_hold to netdev_hold in driver code?

Thanks
Hangbin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ