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: <CAL+tcoCi7+8p2TA21cQvmAP2OLpWRzY03NB9Usp5p39KcgoSBQ@mail.gmail.com>
Date: Wed, 26 Nov 2025 09:25:27 +0800
From: Jason Xing <kerneljasonxing@...il.com>
To: Tonghao Zhang <tonghao@...aicloud.com>
Cc: netdev@...r.kernel.org, Jay Vosburgh <jv@...sburgh.net>, 
	"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, 
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Simon Horman <horms@...nel.org>, 
	Jonathan Corbet <corbet@....net>, Andrew Lunn <andrew+netdev@...n.ch>, 
	Nikolay Aleksandrov <razor@...ckwall.org>, Hangbin Liu <liuhangbin@...il.com>
Subject: Re: [PATCH net-next v1 4/5] net: bonding: add the READ_ONCE/WRITE_ONCE
 for outside lock accessing

On Tue, Nov 25, 2025 at 4:45 PM Tonghao Zhang <tonghao@...aicloud.com> wrote:
>
> Although operations on the variable send_peer_notif are already within
> a lock-protected critical section, there are cases where it is accessed
> outside the lock. Therefore, READ_ONCE() and WRITE_ONCE() should be
> added to it.
>
> Cc: Jay Vosburgh <jv@...sburgh.net>
> Cc: "David S. Miller" <davem@...emloft.net>
> Cc: Eric Dumazet <edumazet@...gle.com>
> Cc: Jakub Kicinski <kuba@...nel.org>
> Cc: Paolo Abeni <pabeni@...hat.com>
> Cc: Simon Horman <horms@...nel.org>
> Cc: Jonathan Corbet <corbet@....net>
> Cc: Andrew Lunn <andrew+netdev@...n.ch>
> Cc: Nikolay Aleksandrov <razor@...ckwall.org>
> Cc: Hangbin Liu <liuhangbin@...il.com>
> Signed-off-by: Tonghao Zhang <tonghao@...aicloud.com>
> ---
>  drivers/net/bonding/bond_main.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 025ca0a45615..5f04197e29f7 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -1204,8 +1204,9 @@ void bond_peer_notify_work_rearm(struct bonding *bond, unsigned long delay)
>  /* Peer notify update handler. Holds only RTNL */
>  static void bond_peer_notify_reset(struct bonding *bond)
>  {
> -       bond->send_peer_notif = bond->params.num_peer_notif *
> -               max(1, bond->params.peer_notif_delay);
> +       WRITE_ONCE(bond->send_peer_notif,
> +                  bond->params.num_peer_notif *
> +                  max(1, bond->params.peer_notif_delay);
>  }
>
>  static void bond_peer_notify_handler(struct work_struct *work)
> @@ -2825,7 +2826,7 @@ static void bond_mii_monitor(struct work_struct *work)
>
>         rcu_read_unlock();
>
> -       if (commit || bond->send_peer_notif) {
> +       if (commit || READ_ONCE(bond->send_peer_notif) {

Also there is a lack of another bracket... It's not hard to spot this
error if you complete compilation.

Thanks,
Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ