Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Vasilij Strassheim" <v.strassheim@linutronix.de>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH 3/4] net: dsa: Add support for SoC-e SDSA tags
Date: Thu, 30 Jul 2026 16:37:58 +0000	[thread overview]
Message-ID: <20260730163759.15CD21F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260729-devel-vstrassheim-soce-dsa-ml-v1-3-be569dae1b20@linutronix.de>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The `sdsa_xmit` and `sdsa_rcv` functions leak the SKB on all error paths by returning `NULL` without freeing the buffer, leading to memory exhaustion.
--

--- Patch [3]: [PATCH 3/4] net: dsa: Add support for SoC-e SDSA tags ---
commit d07af353633eb9eecc24042cfdf75f9ecf082368
Author: Vasilij Strassheim <v.strassheim@linutronix.de>

net: dsa: Add support for SoC-e SDSA tags

Adds a DSA tagger for the SoC-e SDSA header format used between
the conduit and SoC-e switch ports.

> diff --git a/net/dsa/tag_sdsa.c b/net/dsa/tag_sdsa.c
> new file mode 100644
> --- /dev/null
> +++ b/net/dsa/tag_sdsa.c

[ ... ]

> +static struct sk_buff *sdsa_xmit(struct sk_buff *skb, struct net_device *dev)
> +{
> +	struct dsa_port *dp = dsa_user_to_port(dev);
> +	u8 *sdsa_header;
> +
> +	if (skb_cow_head(skb, SDSA_HLEN) < 0)
> +		return NULL;

[Severity: High]
Does this leak the skb when skb_cow_head() fails? The DSA core expects the
tagger to consume and free the skb if it returns NULL on transmission. Should
this call kfree_skb() before returning?

[ ... ]

> +static struct sk_buff *sdsa_rcv(struct sk_buff *skb, struct net_device *dev)
> +{
> +	u8 *sdsa_header;
> +	int source_port;
> +	u8 frame_type;
> +
> +	if (unlikely(!pskb_may_pull(skb, SDSA_HLEN)))
> +		return NULL;

[Severity: High]
Does this error path leak the skb? If a malformed packet causes
pskb_may_pull() to fail, returning NULL without freeing the buffer could
allow network traffic to cause memory exhaustion.

> +
> +	sdsa_header = dsa_etype_header_pos_rx(skb);
> +
> +	/* Check that the frame type is TO_CPU. */
> +	frame_type = FIELD_GET(SDSA_TAG_FRAME_TYPE_MASK, sdsa_header[4]);
> +	if (frame_type != 0)
> +		return NULL;

[Severity: High]
Should the skb be freed here when the frame type check fails to avoid a
memory leak?

> +
> +	/* VLAN-tagged traffic is intentionally unsupported yet. */
> +	if (sdsa_header[4] & SDSA_TAG_VLAN_BIT)
> +		return NULL;

[Severity: High]
Could unsupported VLAN-tagged traffic trigger a memory leak here?

> +
> +	/* Determine the source port from the two port fields. */
> +	source_port = ((sdsa_header[4] & 0x1f) << 5) |
> +		      ((sdsa_header[5] & 0xf8) >> 3);
> +
> +	skb->dev = dsa_conduit_find_user(dev, 0, source_port);
> +	if (!skb->dev)
> +		return NULL;

[Severity: High]
Does this also leak the skb if the conduit cannot find a corresponding user
device?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260729-devel-vstrassheim-soce-dsa-ml-v1-0-be569dae1b20@linutronix.de?part=3

  parent reply	other threads:[~2026-07-30 16:37 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-29 16:36 [PATCH 0/4] net: dsa: Add SoC-e DSA driver Vasilij Strassheim
2026-07-29 16:36 ` [PATCH 1/4] dt-bindings: vendor-prefixes: Add soce Vasilij Strassheim
2026-07-30  8:50   ` Krzysztof Kozlowski
2026-07-29 16:36 ` [PATCH 2/4] dt-bindings: net: dsa: Add SoC-e switch IP and DSA bindings Vasilij Strassheim
2026-07-29 17:11   ` Andrew Lunn
2026-07-29 18:07   ` Rob Herring (Arm)
2026-07-30  8:56   ` Krzysztof Kozlowski
2026-07-30  8:56   ` Krzysztof Kozlowski
2026-07-30 16:37   ` sashiko-bot
2026-07-29 16:36 ` [PATCH 3/4] net: dsa: Add support for SoC-e SDSA tags Vasilij Strassheim
2026-07-29 17:22   ` Andrew Lunn
2026-07-30 16:37   ` sashiko-bot [this message]
2026-07-29 16:36 ` [PATCH 4/4] net: dsa: soce: Add initial driver support for MRS switches Vasilij Strassheim
2026-07-29 17:31   ` Andrew Lunn
2026-07-29 20:05   ` Andrew Lunn
2026-07-30  9:01   ` Krzysztof Kozlowski
2026-07-30 16:37   ` sashiko-bot
2026-07-29 16:56 ` [PATCH 0/4] net: dsa: Add SoC-e DSA driver Andrew Lunn

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=20260730163759.15CD21F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox