From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.160.199 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796529292; b=zit/l4Zs3w4ka+7XRY9LvCRSjuxcYxwUFEL7y96U96mAbCaNWx9RcVMD3Vzq/klCPuvA UHwUj6s1H8CXc+mKV/kR1/HwJwUn0SNtm9V2QGRukT8YndH08DGFeLB7uG1SV3FL9Nq2w MCDW+DbVqQPS7pwyQJtbGr6NVuIrW2boEQnFub7RvylY62+rncQ2nZe03Xjho9q+mJGQO zlqO/qVEbUku+7b4vqDb+muqy5qhg5d8Rf88NKulO6PDSYCsYXWe/9WqV1a58OFgTadR8 9PCtAV1a7rRbiXwNJDf8JjUmnYQqPfH9CcxPXAuYrfz2EMQIxmasEGfSNRvDKUs1g5g== 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=HW4a5O7iEZwQKeqPYRHNGms+I5zjXnyc7aYukeK6WWUYzXtpiDvORCoZWNHNF9XoSdY0 eCqYJyNcaTeM7FVmonDlc32IkUro5/mpYmhTlFuHsCYLmlr4LsXCga7/ESwvyJBpDpuwV i/rc6oVCXxqDRw1aKJ0iKVKu8goO0WhNSHEl/0fHCDXEJ7Nvzv1b/38UPDJlqqjFVofoQ vzLGMC10RcyauohKSvcbfAuptx4L5X9TJgTAGFoGMLf7sfCZpCEG158SJQxnpFlDG4y/D 9n+sj+/mBQRN97QxqhPyiSrBKiYqKbeLcmnW8IrHM0jngkhDs5Dl+z9Nw2EEeiKB67A== 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=jb1glzVs; arc=none smtp.remote-ip=209.85.160.199 Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) (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 B5625606A31F for ; Sun, 6 Dec 2026 03:54:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B5625606A31F 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=jb1glzVs Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-55db3f05536so53550121cf.3 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=1796529290; x=1797134090; 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=jb1glzVsdAkKILqcjvUvDNVQfNBuU+Ksy8tdoNYEwXHe/1GoV6n3dXC/LGZaOTP4Rp Yi/tPb1fvo7Kf3tVnoFA2ybkmoFuqkHlTYGOrOoZZKD/OwCoUGKWk8VN1s2HgbaAfZu7 jlM2+5Ked6dAQCL3KPNZMJKHpDqNZPCJO6Ow0mttY4VsTH61TVdMBsNeeCg2F53WBPqc Yk7PxeCXJjLj5pKmbcFSfbsjanCrbcLPhwgZqR2yr+jYfrMBGYs1/dEgh7f8qWmlzKIz BpDelwmaQbvFsuNYX/fcRZQmOj22L0ZfncsWk+GYOoW9Ff2cahPXwuXDSFDSJrrFoPZf QxAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796529290; x=1797134090; 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=SWHiBUGWbhAG3uCqUl9emx58hK0EI87Khte/mjShWrB+YHhrnAI+o6UY2QhWN2i5yX wMQNXDf9mWvFihyQ541keI00WsJmEjdxBwIqm4CBjA5MaX+MCy0yeWTYF9oUnqztH1c3 vBPY7ZUPwI5XtX3b70zz1BaUgty3T6/kqPmLL7X1zuGxeJG9/rf6OlI3n3E/4NSqTfYB Gvr39DKtH4Ta77PVXvpjMoYfS6dPwPLaXVVPmWQlheOkKrDekkIeqtdJd/4U8bq3kmyW inoxhM6u3uGkOC2aPNBqVUTz0zUR0cLTvsopqgGG8P/1I2GvRrSdNpEr1DfLQ1MJWuGC VrGQ== X-Forwarded-Encrypted: i=1; AL+hErGjRHTdT0k6r3yLGmHpYbOFQbDTg59PKzvu4oOrKpZTuh5u3zaBVRe6Yw3d1S5OCCNNM9JJ7fzpaXrlAW8=@vger.kernel.org X-Gm-Message-State: APuU4Z/S6LD/60BQuYzNYquN7KsbxEQFsIvhHgTBUAb8VQeRjj6dCaop g1fumET8BV700vcBJGN1X39f6Gs92eaT42A62t9hrpo2Zg5z4MeITUz9fO5xFZrX3eJM1DxvGjj wH1FJcsOp5Q== 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: linux-kernel@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