Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 1 · Low: 0 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [Medium] On rocker, this patch adds a WARN that userspace can trigger, and no patch in the series fixes it. -- net: bridge: switchdev: count an offload only after its hwdom is set This patch moves the setting of p->offload_count in nbp_switchdev_add() so it happens after nbp_switchdev_hwdom_set() succeeds. Before, a port whose offload failed with -EBUSY kept a count for an offload that never happened.
> diff --git a/net/bridge/br_switchdev.c b/net/bridge/br_switchdev.c > index 10f3aea6a1f82..8de12d56452dc 100644 > --- a/net/bridge/br_switchdev.c > +++ b/net/bridge/br_switchdev.c > @@ -280,12 +280,13 @@ static int nbp_switchdev_add(struct net_bridge_port *p, > } > > p->ppid = ppid; > - p->offload_count = 1; > > err = nbp_switchdev_hwdom_set(p); > if (err) > return err; > > + p->offload_count = 1; > +
[Severity: Medium] Can this make userspace able to trigger the WARN_ON() in nbp_switchdev_del() on rocker ports? The changelog says so itself: "With this patch, that unoffload hits the WARN_ON() in nbp_switchdev_del()." Neither this patch nor the next one in the series seems to address it. rocker_netdevice_event() only logs the offload failure and returns NOTIFY_DONE: drivers/net/ethernet/rocker/rocker_main.c:rocker_netdevice_event() { ... if (err) netdev_warn(dev, "failed to reflect master linked (err %d)\n", err); ... } So br_add_if() never sees the error and keeps the port in the bridge. Also, ofdpa_port_bridge_join() sets ofdpa_port->bridge_dev = bridge before it calls switchdev_bridge_port_offload(). It does not clear it when the offload fails, so ofdpa_port_is_bridged() is still true when the port is unlinked later. When the port leaves the bridge, the call chain is: del_nbp() netdev_upper_dev_unlink() rocker_netdevice_event() ofdpa_port_master_unlinked() ofdpa_port_bridge_leave() switchdev_bridge_port_unoffload(dev, NULL, NULL, NULL) br_switchdev_blocking_event() br_switchdev_port_unoffload() nbp_switchdev_del() if (WARN_ON(!p->offload_count)) Before this patch, the failed offload left offload_count at 1, so this unoffload was balanced. It now runs with offload_count == 0 and fires the WARN, which panics with panic_on_warn. The -EBUSY case can be reached on the current tree. A CAP_NET_ADMIN user fills hwdoms 1..BR_HWDOM_MAX-1 with ports from other switches, then adds a rocker port from a new switch. While br_add_if() runs, that port is not yet in br->port_list, so nbp_switchdev_hwdom_set() returns -EBUSY. The follow-up patch "net: bridge: switchdev: clear the hwdom of a port that stops the offload" leaves both rocker and the WARN_ON() in nbp_switchdev_del() as they are. The WARN is therefore still reachable at the end of the series. DSA does not have this problem. dsa_port_bridge_join() calls dsa_port_bridge_destroy() when the offload fails, and dsa_port_pre_bridge_leave() returns early when there is no brport_dev. Should rocker be fixed in the same series? One option is to return the error with notifier_from_errno() so br_add_if() unwinds. Another is to record whether the offload succeeded, and skip switchdev_bridge_port_unoffload() in ofdpa_port_bridge_leave() when it did not.
> if (tx_fwd_offload) { > set_bit(BR_TX_FWD_OFFLOAD_BIT, &p->flags); > static_branch_inc(&br_switchdev_tx_fwd_offload);
-- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40gmail.com