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 PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Sat, 10 Dec 2022 18:41:01 +0100 From: Eric Dumazet <edumazet@...gle.com> To: Hangbin Liu <liuhangbin@...il.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>, liali <liali@...hat.com> Subject: Re: [PATCH net 1/3] bonding: access curr_active_slave with rtnl_dereference On Sat, Dec 10, 2022 at 1:28 PM Hangbin Liu <liuhangbin@...il.com> wrote: > > On Sat, Dec 10, 2022 at 12:58:59AM +0100, Eric Dumazet wrote: > > On Fri, Dec 9, 2022 at 11:13 AM Hangbin Liu <liuhangbin@...il.com> wrote: > > > > > > Looks commit 4740d6382790 ("bonding: add proper __rcu annotation for > > > curr_active_slave") missed rtnl_dereference for curr_active_slave > > > in bond_miimon_commit(). > > > > > > Fixes: 4740d6382790 ("bonding: add proper __rcu annotation for curr_active_slave") > > > > > > > Signed-off-by: Hangbin Liu <liuhangbin@...il.com> > > > --- > > > drivers/net/bonding/bond_main.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c > > > index b9a882f182d2..2b6cc4dbb70e 100644 > > > --- a/drivers/net/bonding/bond_main.c > > > +++ b/drivers/net/bonding/bond_main.c > > > @@ -2689,7 +2689,7 @@ static void bond_miimon_commit(struct bonding *bond) > > > > > > bond_miimon_link_change(bond, slave, BOND_LINK_UP); > > > > > > - if (!bond->curr_active_slave || slave == primary) > > > + if (!rtnl_dereference(bond->curr_active_slave) || slave == primary) > > > > We do not dereference the pointer here. > > > > If this is fixing a sparse issue, then use the correct RCU helper for this. > > > > ( rcu_access_pointer()) > > Hmm... I saw in 4740d6382790 ("bonding: add proper __rcu annotation for > curr_active_slave") there are also some dereference like that. Should I also > fix them at the same time? e.g. There is no 'fix' really. I do not see any reason to change this part. It is merely a matter of repeating or not the fact that RTNL (or another lock) is held. > > @@ -2607,8 +2612,8 @@ static void bond_ab_arp_commit(struct bonding *bond) > > case BOND_LINK_UP: > trans_start = dev_trans_start(slave->dev); > - if (bond->curr_active_slave != slave || > - (!bond->curr_active_slave && > + if (rtnl_dereference(bond->curr_active_slave) != slave || > + (!rtnl_dereference(bond->curr_active_slave) && > At the time of commit 4740d6382790 we wanted to make sure the bond->curr_slave_lock was taken, because it was the assertion at that time. Then later, bond_deref_active_protected() has been removed, because curr_slave_lock has been removed. $ git log --oneline --reverse b25bd2515ea32cf5ddd5fd5a2a93b8c9dd875e4f..8c0bc550288d81e9ad8a2ed9136a72140b9ef507 86e749866d7c6b0ee1f9377cf7142f2690596a05 bonding: 3ad: clean up curr_slave_lock usage 62c5f5185397f4bd8e5defe6fcb86420deeb2b38 bonding: alb: remove curr_slave_lock 1c72cfdc96e63bf975cab514c4ca4d8a661ba0e6 bonding: clean curr_slave_lock use b743562819bd97cc7c282e870896bae8016b64b5 bonding: convert curr_slave_lock to a spinlock and rename it 4bab16d7c97498e91564231b922d49f52efaf7d4 bonding: alb: convert to bond->mode_lock e470259fa1bd7ce5a375b16c5ec97cc0e83b058d bonding: 3ad: convert to bond->mode_lock 8c0bc550288d81e9ad8a2ed9136a72140b9ef507 bonding: adjust locking comments Now, you post a patch for bond_miimon_commit() which already has : if (slave == rcu_access_pointer(bond->curr_active_slave)) goto do_failover; So really it is a matter of consistency in _this_ function, which is run under RTNL for sure. It is also a patch for net-next tree, because it fixes no bug. I would not add a Fixes: tag to avoid dealing with useless backports.
Powered by blists - more mailing lists