public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/2] net: bonding: fix type-confusion in bonding header_ops
@ 2026-03-05 11:07 Kota Toda
  2026-03-05 11:07 ` [PATCH v4 1/2] " Kota Toda
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Kota Toda @ 2026-03-05 11:07 UTC (permalink / raw)
  To: Jeff Garzik, Jay Vosburgh; +Cc: Kota Toda, netdev, linux-kernel, Yuki Koike

In bond_setup_by_slave(), the slave’s header_ops are unconditionally
copied into the bonding device. As a result, the bonding device may invoke
the slave-specific header operations on itself, causing
netdev_priv(bond_dev) (a struct bonding) to be incorrectly interpreted
as the slave's private-data type.

This type-confusion bug can lead to out-of-bounds writes into the skb,
resulting in memory corruption.

Patch 1 stores the slave's header_ops in struct bonding and sets
wrapper callbacks in bond_In bond_setup_by_slave(), the slave’s
header_ops are unconditionally
copied into the bonding device. As a result, the bonding device may invoke
the slave-specific header operations on itself, causing
netdev_priv(bond_dev) (a struct bonding) to be incorrectly interpreted
as the slave's private-data type.

Patch 2 uses READ_ONCE when loading header_ops callbacks
to avoid races with concurrent updates.

Fixes: 1284cd3a2b74 ("bonding: two small fixes for IPoIB support")
Signed-off-by: Kota Toda <kota.toda@gmo-cybersecurity.com>
Co-developed-by: Yuki Koike <yuki.koike@gmo-cybersecurity.com>
Signed-off-by: Yuki Koike <yuki.koike@gmo-cybersecurity.com>

Kota Toda (2):
  net: bonding: fix type-confusion in bonding header_ops
  net: add READ_ONCE for header_ops callbacks

 drivers/net/bonding/bond_main.c | 67 ++++++++++++++++++++++++++++++++-
 include/linux/netdevice.h       | 41 ++++++++++++++------
 include/net/bonding.h           |  5 +++
 include/net/cfg802154.h         |  2 +-
 net/core/neighbour.c            |  6 +--
 net/ipv4/arp.c                  |  2 +-
 net/ipv6/ndisc.c                |  2 +-
 7 files changed, 106 insertions(+), 19 deletions(-)

-- 
2.53.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-03-10 10:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-05 11:07 [PATCH v4 0/2] net: bonding: fix type-confusion in bonding header_ops Kota Toda
2026-03-05 11:07 ` [PATCH v4 1/2] " Kota Toda
2026-03-05 11:07 ` [PATCH v4 2/2] net: read header_ops callbacks with READ_ONCE() Kota Toda
2026-03-05 20:59 ` [PATCH v4 0/2] net: bonding: fix type-confusion in bonding header_ops Jay Vosburgh
2026-03-06  8:06   ` Jiayuan Chen
2026-03-06  8:13   ` Jiayuan Chen
2026-03-10 10:45   ` 戸田晃太

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox