From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.222.198 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796529292; b=EGjq2guKdwuJRJiimq3uNGyc74AvqXF9biDDZvAWMC6n9U/b7lkSgL2dIKqdEhcmF9Wu CTeqAQOy/mHWj/+N3VQHyTTd/UYIHP/6mb3WJvEeSvLXt08hFudCn40GdfsB14immhhpA f87bXG0t4cO+HE8M+fcWo8OKrw6Jir56mV0vC8Bzqm79MsOtRWMW8XrqPg1hFTY9Ak7cP sieFrqtYjXN+nZhiJp4FDL5Dboi6hKybZRr0XoCZFU/CycyTKxWsFabGVwmauFhAASlkL HnPMiTdKUAnfNerenI91ogalTY5/HC7z7ThZl37AUljScthnYUzMQ+7CBGJ53dcYpvw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796529292; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:Date:In-Reply-To: Mime-Version:References:Message-ID:Subject:From:To:Cc:Content-Type; bh=cE+yEgdMFtFHaGJaWLZ0+anj+KxY6U6L8dS1twsf7bs=; b=qncZkCW5MSs/fS3pTXHO+wxbF2+z2QAA1mjfiZWwz5RHaw7lOaiGrQNKXJDHrCdacron gP++gQDn8C7t5pe68mCY0ILZMthqrIE0/v0zIJfr2mymNUehhPUMTqpWR5l2AxdVuulGk GXoexHCVqz9GwUdh4qVNxnNmmjJPjWokvbdsc/DBBRpod84UZc8MzTGxGcUbcFm+EWIld +gyC/lqZXYKUfXFUjLU21NQD3E9Q3kTUHDsCaSCY0nDdS83Gu7hyqJc7zJrxHC4Mff/Pe 1hAgfaxP0Oj4FC1ie8LHN3G7qZutfpQOFM3E9rMP5lZDj6I/cUhjbaKVXWpDmfM2WiA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=google.com; spf=pass smtp.mailfrom=flex--willemb.bounces.google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=GVgYQjF6; arc=none smtp.remote-ip=209.85.222.198 Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DC5A9606A321 for ; Sun, 6 Dec 2026 03:54:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DC5A9606A321 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--willemb.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=GVgYQjF6 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-94a7d3639e1so362706685a.2 for ; Sat, 05 Dec 2026 19:54:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796529291; x=1797134091; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=cE+yEgdMFtFHaGJaWLZ0+anj+KxY6U6L8dS1twsf7bs=; b=GVgYQjF6nPfeAwFq1Kc2XGKej2aF591NgycmlslyoY/8Eb8cieuL5hqS3p33jlI37i csM8L/k7bCI5b0uVYwfIuLcZzbsAJtJebXMuN8CToihq0WQFLcWa44Lf45+TwZqDQJKX 8LP5r5L3aGSusvh57SuIeWwTuaTSxTAS0HZeS4JsaH89ZBJo2+TogLHSeX1ROYifMhMO +uByF/LYDQbcGsxw1ZFr088EC2szJ3MTvTKO03MLnTLSh8VUI+v/PSPia21GqTXudVp4 cbCWZgeGkTY8XT0dGZpaO2IZRxEpl9RdXW2rCcttpHU2sytFG9j5m78Jksdn9+vjjAIb dzoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796529291; x=1797134091; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=cE+yEgdMFtFHaGJaWLZ0+anj+KxY6U6L8dS1twsf7bs=; b=IzebijamE3pI+1hpX0JQJv35XaDNE+jCZ6qLEFOwaCsc/3OdH88oUx0Jdzay7uElrs ViMKtY7e44QnnBOoP2MA4H1I0RWD3pC0Ub1xZXA4gD1mGCi+GtKWPLQP1Yq9iqmwXuJX uXpqaKP1KQs9LjGk88ZzDgvo1vldtwDDkj/IVsRnWLHVNavcyLNJsmqChngP6/uq/ueX HOQ1OhrcNKVLHGZJYG91Imj1M9Tb5+9846l0F3Z79nOzs1jLFtHHH+6wHUK8OPNCbjip J2cH14z6gOBLNXSKGLFcm7miUeuB7YoBy32s5gdt+R/EvqslzbtrHRFOLatAHfCeHw6r 2uFQ== X-Forwarded-Encrypted: i=1; AL+hErENkC+tn5QXyiXhzN4eXONk1UE7SxLQOknD38yB2hNaGJblr+PwQTqn3I6M9ix/c4g3Y8Cpq0Q=@vger.kernel.org X-Gm-Message-State: APuU4Z9gIaftvBYf8rARbh6b6V3wl47s1SlBvuRLX302hmv1phA00+02 fd2ql2iu8Lv1FCvSii4/Vsww8wnHymLwhFKvQgIb4Xg/F28s6aT1/U03/GSqI5X0Fa7joLKU1p9 YC6b3DUTHBA== X-Received: from qkss29.prod.google.com ([2002:a05:620a:81d:b0:946:7d9:9d53]) (user=willemb job=prod-delivery.src-stubby-dispatcher) by 2002:a05:620a:4147:b0:93f:2aa8:c555 with SMTP id af79cd13be357-94a82dffc1amr1008533485a.57.1796529290383; Sat, 05 Dec 2026 19:54:50 -0800 (PST) Date: Sat, 05 Dec 2026 22:54:49 -0500 In-Reply-To: <20261128165206.3248835-3-julius@bairaktaris.de> X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 References: <20261128165206.3248835-1-julius@bairaktaris.de> <20261128165206.3248835-3-julius@bairaktaris.de> Message-ID: Subject: Re: [PATCH net 2/6] net: dsa: tag_sja1105, tag_vsc73xx_8021q: read the bridge once in xmit From: willemb@google.com To: Julius Bairaktaris , Andrew Lunn , Vladimir Oltean , netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Willem de Bruijn , Simon Horman , "=?UTF-8?B?QWx2aW4gxaBpcHJhZ2E=?=" , Linus Walleij , Florian Fainelli , Pawel Dembicki , Tobias Waldekranz , Daniel Golle , Russell King , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8"; format=flowed; delsp=yes Julius Bairaktaris wrote: > A frame received on a port that offloads a bridge carries > offload_fwd_mark (dsa_default_offload_fwd_mark()). A tc mirred redirect > or mirror, or an nft netdev fwd or dup, from that port to a standalone > port of the same switch keeps the mark, and vsc73xx_xmit() and > sja1105_imprecise_xmit() then look up the bridge of the standalone port: > dsa_port_bridge_dev_get() returns NULL and br_vlan_enabled() dereferences > it, in softirq, for every such frame. The same happens when a port leaves > its bridge while a frame that the bridge marked is still queued for it. > Both taggers also read dp->bridge twice, once for the device and once > for the number. > Read dp->bridge once. When the port is not in a bridge, it is a > standalone port, so send the frame in its standalone VLAN, to the port > alone, with the PCP of its TX queue, as for a frame without > offload_fwd_mark. > Both drivers are fixed in one commit because they share the mechanism. > Found by an LLM review (Claude), and reproduced in QEMU with dsa_loop. > Fixes: b6ad86e6ad6c ("net: dsa: sja1105: add bridge TX data plane offload > based on tag_8021q") > Fixes: 6c87e1a47928 ("net: dsa: vsc73xx: introduce tag 8021q for vsc73xx") > Signed-off-by: Julius Bairaktaris - net/dsa/tag_sja1105.c:221-224 (sja1105_imprecise_xmit): When skb->offload_fwd_mark is set and !bridge, the new fallback inside sja1105_imprecise_xmit() immediately sends the frame through dsa_8021q_xmit() in the port's standalone tag_8021q VLAN, bypassing sja1105_is_link_local(skb) in both sja1105_xmit() (lines 289-295, SPI management routes via sja1105_defer_xmit()) and sja1110_xmit() (lines 320-351, in-band control extension header/trailer). SJA1105/SJA1110 hardware matches 01:80:C2:xx:xx:xx and PTP 01:1B:19:xx:xx:xx (include/linux/dsa/sja1105.h:22-26) in its management filters, so link-local or PTP frames carrying offload_fwd_mark (e.g., redirected from another switch's bridged port or bridge-forwarded with group_fwd_mask / PTP multicast right before port leave) must take the control path, not dsa_8021q_xmit(). Fix cleanly by checking READ_ONCE(dp->bridge) in sja1105_xmit() and sja1110_xmit() and only calling sja1105_imprecise_xmit(skb, netdev, bridge) when bridge != NULL, letting !bridge fall through to the normal standalone path (which also removes the extra pcp parameter). - tag_vsc73xx_8021q) net/dsa/tag_sja1105.c:282,313, net/dsa/tag_vsc73xx_8021q.c:19: Same root architectural gap as Patch 3/6: tc mirred and nft netdev fwd/dup do not clear RX skb->offload_fwd_mark on egress redirect, so redirecting from a bridged ingress port to a *bridged* sja1105/vsc73xx port (e.g. in another bridge) still enters imprecise bridge-wide TX forwarding (or returns an untagged/wrong-VLAN frame