linux/drivers/net/bonding
Tonghao Zhang f49962e51a net: bonding: fix possible peer notify event loss or dup issue
commit 10843e1492 upstream.

If the send_peer_notif counter and the peer event notify are not synchronized.
It may cause problems such as the loss or dup of peer notify event.

Before this patch:
- If should_notify_peers is true and the lock for send_peer_notif-- fails, peer
  event may be sent again in next mii_monitor loop, because should_notify_peers
  is still true.
- If should_notify_peers is true and the lock for send_peer_notif-- succeeded,
  but the lock for peer event fails, the peer event will be lost.

This patch locks the RTNL for send_peer_notif, events, and commit simultaneously.

Fixes: 07a4ddec3c ("bonding: add an option to specify a delay between peer notifications")
Cc: Jay Vosburgh <jv@jvosburgh.net>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Hangbin Liu <liuhangbin@gmail.com>
Cc: Nikolay Aleksandrov <razor@blackwall.org>
Cc: Vincent Bernat <vincent@bernat.ch>
Cc: <stable@vger.kernel.org>
Signed-off-by: Tonghao Zhang <tonghao@bamaicloud.com>
Acked-by: Jay Vosburgh <jv@jvosburgh.net>
Link: https://patch.msgid.link/20251021050933.46412-1-tonghao@bamaicloud.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2025-10-29 14:03:11 +01:00
..
bond_3ad.c bonding: update LACP activity flag after setting lacp_active 2025-08-28 16:24:38 +02:00
bond_alb.c bonding: return -ENOMEM instead of BUG in alb_upper_dev_walk 2024-02-23 08:54:41 +01:00
bond_debugfs.c bonding: fix error checking in bond_debug_reregister() 2023-02-14 19:17:58 +01:00
bond_main.c net: bonding: fix possible peer notify event loss or dup issue 2025-10-29 14:03:11 +01:00
bond_netlink.c bonding: fix send_peer_notif overflow 2023-06-05 09:21:19 +02:00
bond_options.c bonding: update LACP activity flag after setting lacp_active 2025-08-28 16:24:38 +02:00
bond_procfs.c Bonding: add arp_missed_max option 2023-06-05 09:21:19 +02:00
bond_sysfs.c Bonding: add arp_missed_max option 2023-06-05 09:21:19 +02:00
bond_sysfs_slave.c bonding: Fix a use-after-free problem when bond_sysfs_slave_add() failed 2021-11-18 19:17:08 +01:00
bonding_priv.h drivers: Remove inclusion of vermagic header 2020-04-21 13:27:37 -07:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00