From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796344063; b=xvpe7TcZfg1jDEsF0TLs2pWGQwrR9zAy2V1C5YBblWHuok46uIIU/6qgQlfqlxve4IrM qjbjNvkUNQeAUBKdKOm0ZBhODz0F2QO65FsZZTGBuH62yfpZs8xRqbxx25ENlMycHs7Ma T6vzCXPda8TbFGHaZt41PJpb+wjWdztHyCgu2s3xHZQNrE4PqGey1AIeByoShjfMsBRTk 4FRYQgmgAL2BlT0i4YP7ehizT9fP5vj1VKdHfEa8dWJnXXk5G1Tio5ehjpsTig3Yc3rNQ LnLj0YLsWmsMwV8Rl6JvucG7RUFFpFQEByk10vgh6pd0um324UacULo/srlrooW/ulw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796344063; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=l25MkAs36+LDUtjo3aTSduVWvfR2CAQiaTz2bEZ2Mok=; b=z81+N7dlWUmwzDsd+dkG44H/czDR/odzytF4VgDDA/zxRuClVUA8MyacACbGVdliEh+F 56JwwgxQlBs7ktTDcVtvcJfyLMtepIsQkHX0cG2ZKzgr9XctIaI7UOiF9rDpRKkzctrdJ Q+NAXl/dONJeVPgqO8exzL3O+S6uYmMvtFKK7WtnQ7SFS7XlRAgyA4OWunERC6HcluZMU 5heQ5XY0hdbEbeApvApZsrkskVJ0QdWfeeBpoUx1xvRkvQnCSt6CkfYn01xd28tF9lN6J HMFmsl3kvAVpBXaAuwIGzQ6sZq6NqF2E/BZ31jWHdNlXg4JcQSL7HZCdyFCOHxcwKIw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=G1hj1jfQ; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 23E44606A322; Fri, 4 Dec 2026 00:27:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=G1hj1jfQ Received: by smtp.kernel.org (Postfix) with ESMTPSA id D55BA1F00897; Fri, 4 Dec 2026 00:27:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796344062; bh=l25MkAs36+LDUtjo3aTSduVWvfR2CAQiaTz2bEZ2Mok=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=G1hj1jfQbHCYROVEJ2HJt4FEcs4z+edbqvi2tWliiVIc87oB/gdSwdB/rbCqHQ7YK 9o4rU8e57Q4UveXsrvUdoNn1ed0inoy08dghEV8j2lZZ54HBojauoBjzDZYccwmgnS JtsUZBL6fwUg0FLPQxzyk/HFSC9yYnZLL7yWWL9NOzsckutYyHSOMgELiu3fKbUku4 l8xUzWll/2wKN9z78Kh5/Y3BEuZtJc1Hteg4RuIa2EzGgL9KaA/bbIthhkc26I0QVU TqGmKP7oNdv4kiAqfmxSzk+irvB7ChKaSWkYbVU6KSxtnpXxtanwUms6Zm57SIE7Mg kmh1lGTH7yg9A== Subject: Re: [PATCH net v2 1/2] net: bridge: switchdev: count an offload only after its hwdom is set From: netdev-bot+sashiko@kernel.org To: koralilgun@gmail.com Cc: razor@blackwall.org, idosch@nvidia.com, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, willemb@google.com, horms@kernel.org, vladimir.oltean@nxp.com, ioana.ciornei@nxp.com, andrew@lunn.ch, jiri@resnulli.us, daniel.machon@microchip.com, bridge@lists.linux.dev, netdev@vger.kernel.org, koral.ilgun@adtran.com Date: Fri, 04 Dec 2026 00:27:41 +0000 Message-ID: <179634406142.3146.16588048091797797302@kernel.org> In-Reply-To: <20261203002451.517879-2-koralilgun@gmail.com> References: <20261203002451.517879-2-koralilgun@gmail.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: bridge@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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/20261203002451.517879-1-koralilgun%40gmail.com