All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Vasilij Strassheim" <v.strassheim@linutronix.de>
Cc: devicetree@vger.kernel.org, mfd@lists.linux.dev, robh@kernel.org,
	conor+dt@kernel.org, lee@kernel.org
Subject: Re: [PATCH net-next v4 5/8] net: dsa: Add tag handling for SoC-e switches
Date: Fri, 06 Nov 2026 14:17:36 +0000	[thread overview]
Message-ID: <sashiko-outbox-201561@kernel.org> (raw)
In-Reply-To: <20261105-devel-vstrassheim-soce-dsa-ml-v4-5-02f3cde2afa1@linutronix.de>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] net: dsa: insufficient skb headroom in sdsa_xmit() for
  non-802.1Q VLAN
--

commit ae5577cfb919384ffe32e9238c7345ef431b5a12
Author: Vasilij Strassheim <v.strassheim@linutronix.de>

net: dsa: Add tag handling for SoC-e switches

This commit adds a DSA tag driver for SoC-e switches using an 8-byte
EtherType 0xdcdc SDSA header. It handles transmit and receive frame
tagging, including 802.1Q TCI metadata encoding and non-802.1Q VLAN
header insertion.

> diff --git a/net/dsa/tag_sdsa.c b/net/dsa/tag_sdsa.c
> new file mode 100644
> index 0000000000000..dcfa5de0ac6bd
> --- /dev/null
> +++ b/net/dsa/tag_sdsa.c
> @@ -0,0 +1,168 @@

[ ... ]

> +static struct sk_buff *sdsa_xmit(struct sk_buff *skb, struct net_device *dev)
> +{
> +	struct dsa_port *dp = dsa_user_to_port(dev);
> +	struct sdsa_tag *tag;
> +	bool encode_vlan;
> +	bool tag_present;
> +	u16 vlan_tci;
> +
> +	BUILD_BUG_ON(sizeof(*tag) != SDSA_HLEN);
> +
> +	/* SDSA carries no TPID, so only encode 802.1Q C-tags. */
> +	tag_present = skb_vlan_tag_present(skb);
> +	encode_vlan = tag_present && skb->vlan_proto == htons(ETH_P_8021Q);
> +	/* Prevent the conduit from inserting a VLAN header ahead of SDSA. */
> +	if (tag_present && !encode_vlan) {
> +		skb = __vlan_hwaccel_push_inside(skb);
> +		if (!skb)
> +			return NULL;
> +	}
> +
> +	skb_push(skb, SDSA_HLEN);

[Severity: High]
Can this skb_push(skb, SDSA_HLEN) underflow skb->head and trigger
skb_under_panic() when transmitting a packet with a non-802.1Q hardware
accelerated VLAN tag (for example ETH_P_8021AD)?

sdsa_netdev_ops sets needed_headroom to SDSA_HLEN (8 bytes), so
dsa_user_xmit() -> skb_ensure_writable_head_tail() only guarantees
SDSA_HLEN + conduit->needed_headroom bytes of headroom before calling
sdsa_xmit():

dsa_user_xmit()
  skb_ensure_writable_head_tail(skb, dev)
  sdsa_xmit()
    __vlan_hwaccel_push_inside()
      __vlan_insert_inner_tag()
        skb_cow_head(skb, VLAN_HLEN)
        skb_push(skb, VLAN_HLEN)
    skb_push(skb, SDSA_HLEN)

When skb enters sdsa_xmit() with 8 to 11 bytes of headroom,
__vlan_hwaccel_push_inside() sees enough room for VLAN_HLEN (4 bytes)
without reallocating and consumes 4 bytes via skb_push(skb, VLAN_HLEN),
leaving only 4 to 7 bytes of headroom before skb_push(skb, SDSA_HLEN)
pushes another 8 bytes.

Should sdsa_xmit() call skb_cow_head() before pushing, or should
sdsa_netdev_ops reserve SDSA_HLEN + VLAN_HLEN in needed_headroom?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261105-devel-vstrassheim-soce-dsa-ml-v4-0-02f3cde2afa1@linutronix.de?part=5

  reply	other threads:[~2026-11-06 14:17 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05 14:16 [PATCH net-next v4 0/8] net: dsa: Add support for SoC-e Ethernet switch IP cores Vasilij Strassheim
2026-11-05 14:16 ` [PATCH net-next v4 1/8] dt-bindings: vendor-prefixes: Add soce Vasilij Strassheim
2026-11-05 14:16 ` [PATCH net-next v4 2/8] dt-bindings: net: Add SoC-e SWIP MDIO controller Vasilij Strassheim
2026-11-05 14:16 ` [PATCH net-next v4 3/8] dt-bindings: net: dsa: Add SoC-e SWIP switch function Vasilij Strassheim
2026-11-06 14:17   ` sashiko-bot
2026-11-12 10:33   ` Krzysztof Kozlowski
2026-11-05 14:16 ` [PATCH net-next v4 4/8] dt-bindings: mfd: Add SoC-e SWIP parent Vasilij Strassheim
2026-11-06 11:13   ` Krzysztof Kozlowski
2026-11-06 21:51     ` Vasilij Strassheim
2026-11-10 16:10       ` Vasilij Strassheim
2026-11-10 19:21         ` Rob Herring
2026-11-06 14:17   ` sashiko-bot
2026-11-05 14:16 ` [PATCH net-next v4 5/8] net: dsa: Add tag handling for SoC-e switches Vasilij Strassheim
2026-11-06 14:17   ` sashiko-bot [this message]
2026-11-05 14:16 ` [PATCH net-next v4 6/8] net: mdio: Add SoC-e SWIP MDIO controller driver Vasilij Strassheim
2026-11-05 14:16 ` [PATCH net-next v4 7/8] net: dsa: soce: Add basic support for SoC-e switch IP cores Vasilij Strassheim
2026-11-05 14:16 ` [PATCH net-next v4 8/8] net: dsa: soce: Add VLAN membership table support Vasilij Strassheim
2026-11-06 14:17   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-201561@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=lee@kernel.org \
    --cc=mfd@lists.linux.dev \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=v.strassheim@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.