640-net-bridge-fix-switchdev-host-mdb-entry-updates.patch 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. From: Felix Fietkau <[email protected]>
  2. Date: Thu, 22 Aug 2024 18:02:17 +0200
  3. Subject: [PATCH] net: bridge: fix switchdev host mdb entry updates
  4. When a mdb entry is removed, the bridge switchdev code can issue a
  5. switchdev_port_obj_del call for a port that was not offloaded.
  6. This leads to an imbalance in switchdev_port_obj_add/del calls, since
  7. br_switchdev_mdb_replay has not been called for the port before.
  8. This can lead to potential multicast forwarding issues and messages such as:
  9. mt7915e 0000:01:00.0 wl1-ap0: Failed to del Host Multicast Database entry
  10. (object id=3) with error: -ENOENT (-2).
  11. Fix this issue by checking the port offload status when iterating over
  12. lower devs.
  13. Signed-off-by: Felix Fietkau <[email protected]>
  14. ---
  15. --- a/net/bridge/br_switchdev.c
  16. +++ b/net/bridge/br_switchdev.c
  17. @@ -571,10 +571,18 @@ static void br_switchdev_host_mdb(struct
  18. struct net_bridge_mdb_entry *mp, int type)
  19. {
  20. struct net_device *lower_dev;
  21. + struct net_bridge_port *port;
  22. struct list_head *iter;
  23. - netdev_for_each_lower_dev(dev, lower_dev, iter)
  24. + rcu_read_lock();
  25. + netdev_for_each_lower_dev(dev, lower_dev, iter) {
  26. + port = br_port_get_rcu(lower_dev);
  27. + if (!port || !port->offload_count)
  28. + continue;
  29. +
  30. br_switchdev_host_mdb_one(dev, lower_dev, mp, type);
  31. + }
  32. + rcu_read_unlock();
  33. }
  34. static int