Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/2] net: bridge: switchdev state of fdb entries made dynamic or roamed
@ 2026-11-22 19:21 Julius Bairaktaris
  2026-11-22 19:21 ` [PATCH net-next v2 1/2] net: bridge: withdraw the switchdev entry of an fdb entry made dynamic Julius Bairaktaris
  2026-11-22 19:21 ` [PATCH net-next v2 2/2] net: bridge: clear the offloaded flag of an fdb entry that roams Julius Bairaktaris
  0 siblings, 2 replies; 5+ messages in thread
From: Julius Bairaktaris @ 2026-11-22 19:21 UTC (permalink / raw)
  To: Nikolay Aleksandrov, Ido Schimmel
  Cc: netdev, bridge, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Simon Horman, Vladimir Oltean, Vladimir Oltean,
	Jesse Brandeburg

When the user turns an fdb entry that switchdev was told about into one
added as "master dynamic", the bridge reports neither that change nor
the entry's later deletion, so drivers keep the entry after the bridge
dropped it. When the bridge withdraws an entry from a port's driver and
keeps it, which that change and a learned entry moving to another port
both do, the entry keeps the offloaded flag, so "bridge fdb show" and
"bridge fdb flush ... offloaded" treat it as offloaded while nothing
holds it.

Patch 1 reports the deletion of such an entry to switchdev before the
entry becomes one that is not reported, and clears the offloaded flag
with it. Patch 2 clears the offloaded flag when a learned entry roams,
right after the deletion is reported to the old port.

Both were found by an LLM review: patch 1 in a review of the
series "net: dsa: fix host fdb refcount when an entry roams", patch 2 in
one of __fdb_update() while patch 1 was reworked after its v1 review.

Trigger: patch 1, a local user with CAP_NET_ADMIN runs "bridge fdb
replace <addr> dev <port> master dynamic" (or "... master use") on an
entry that a switchdev driver offloaded; patch 2, an address learned on
one bridge port is seen on another, as when a host moves, and the old
port's driver had offloaded the entry while the new port's does not
(DSA with assisted learning on the CPU port, entries learned by a
switch). Shown in QEMU with dsa_loop. Impact: patch 1, the switch keeps
the entry for the old port after the bridge dropped it; patch 2, a
wrong "offload" flag in the bridge's view. No crash or memory
corruption. CVSS 3.1: patch 1 2.3 (AV:L/AC:L/PR:H/UI:N/S:U/C:N/I:L/A:N),
patch 2 0.0. Until the fix: delete the entry and add it again instead
of replacing it; the wrong flag of patch 2 goes when the entry ages out.

In QEMU with KASAN, with dsa_loop given FDB operations and assisted
learning on the CPU port, and a tc mirred redirect that delivers frames
to a dsa_loop user port (test-only setup): a static entry on a user
port replaced by "master dynamic", and an address learned on a veth
port, which is a host address on the CPU port, replaced by "master
dynamic" or "master use", are not deleted from the switch and are still
shown as offloaded without the series, in 3 of 3 boots each. With it,
each is deleted from the switch and no longer shown as offloaded, in 3
of 3 boots each. An address learned on the veth port and then on the
user port is still shown as offloaded with patch 1 alone and not with
both, in 3 of 3 boots each.

I used Claude (Anthropic) to help write these patches.

v2:
- net-next instead of net, so without the Fixes: tag; the commit that
  introduced the filter is named in the first paragraph of patch 1
  (Nikolay).
- Patch 1 clears the offloaded flag with the withdrawal: a "master
  static" entry the driver had offloaded kept it after "replace ...
  master dynamic" deleted the entry from the hardware (Nikolay).
  br_fdb_offloaded_set() assigns the flag instead of toggling it, so the
  clear cannot be inverted by a concurrent report.
- Call br_switchdev_fdb_notify() directly, no helper (Nikolay).
- Drop the comments in __fdb_update() (Nikolay).
- New patch 2.

v1: https://lore.kernel.org/netdev/20261121191638.1724620-1-julius@bairaktaris.de/



Julius Bairaktaris (2):
  net: bridge: withdraw the switchdev entry of an fdb entry made dynamic
  net: bridge: clear the offloaded flag of an fdb entry that roams

 net/bridge/br_fdb.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)


base-commit: eb6d6c80d35449c27471b1874f13066c09a8964d
-- 
2.53.0


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

end of thread, other threads:[~2026-11-23 19:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-22 19:21 [PATCH net-next v2 0/2] net: bridge: switchdev state of fdb entries made dynamic or roamed Julius Bairaktaris
2026-11-22 19:21 ` [PATCH net-next v2 1/2] net: bridge: withdraw the switchdev entry of an fdb entry made dynamic Julius Bairaktaris
2026-11-23 19:23   ` netdev-bot+sashiko
2026-11-22 19:21 ` [PATCH net-next v2 2/2] net: bridge: clear the offloaded flag of an fdb entry that roams Julius Bairaktaris
2026-11-23 19:23   ` netdev-bot+sashiko

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