devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vasilij Strassheim <v.strassheim@linutronix.de>
To: sashiko-reviews@lists.linux.dev
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: Mon, 03 Aug 2026 18:52:00 +0200	[thread overview]
Message-ID: <95963572ab3aedd2322d76107b70e67cf32db808.camel@linutronix.de> (raw)
In-Reply-To: <20260730163759.15CD21F000E9@smtp.kernel.org>

On Thu, 2026-07-30 at 16:37 +0000, sashiko-bot@kernel.org wrote:
> 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?
> 

Yes, I will fix all this findings.

> [ ... ]
> 
> > +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.
> 

Yes, I will fix all this findings.

> > +
> > +	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?
> 

Yes, I will fix all this findings.

> > +
> > +	/* 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?
> 

Yes, I will fix all this findings.

> > +
> > +	/* 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?

Yes, I will fix all this findings.



  reply	other threads:[~2026-08-03 16:52 UTC|newest]

Thread overview: 50+ 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-08-03 16:03     ` Vasilij Strassheim
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-08-03 15:29     ` Vasilij Strassheim
2026-08-03 16:35       ` Andrew Lunn
2026-08-05 12:33         ` Vasilij Strassheim
2026-07-29 18:07   ` Rob Herring (Arm)
2026-08-03 15:47     ` Vasilij Strassheim
2026-07-30  8:56   ` Krzysztof Kozlowski
2026-08-03 16:15     ` Vasilij Strassheim
2026-08-03 16:43       ` Andrew Lunn
2026-08-05 12:40         ` Vasilij Strassheim
2026-08-05 12:53           ` Andrew Lunn
2026-08-05 13:17             ` Vasilij Strassheim
2026-08-05 13:32         ` Benedikt Spranger
2026-08-05 13:53           ` Andrew Lunn
2026-08-05 14:27             ` Benedikt Spranger
2026-08-06 13:35               ` Andrew Lunn
2026-08-06 15:25                 ` Benedikt Spranger
2026-08-04  6:25       ` Krzysztof Kozlowski
2026-08-05 13:03         ` Vasilij Strassheim
2026-07-30  8:56   ` Krzysztof Kozlowski
2026-08-03 16:16     ` Vasilij Strassheim
2026-07-30 16:37   ` sashiko-bot
2026-08-03 16:35     ` Vasilij Strassheim
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-08-03 15:37     ` Vasilij Strassheim
2026-08-03 16:46       ` Andrew Lunn
2026-08-05 12:47         ` Vasilij Strassheim
2026-07-30 16:37   ` sashiko-bot
2026-08-03 16:52     ` Vasilij Strassheim [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-08-03 15:40     ` Vasilij Strassheim
2026-07-29 20:05   ` Andrew Lunn
2026-08-03 16:01     ` Vasilij Strassheim
2026-08-03 16:49       ` Andrew Lunn
2026-08-05 12:48         ` Vasilij Strassheim
2026-07-30  9:01   ` Krzysztof Kozlowski
2026-08-03 16:23     ` Vasilij Strassheim
2026-07-30 16:37   ` sashiko-bot
2026-08-03 16:44     ` Vasilij Strassheim
2026-07-29 16:56 ` [PATCH 0/4] net: dsa: Add SoC-e DSA driver Andrew Lunn
2026-08-03 15:22   ` Vasilij Strassheim
2026-08-03 16:32     ` Andrew Lunn
2026-08-05 12:28       ` Vasilij Strassheim

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=95963572ab3aedd2322d76107b70e67cf32db808.camel@linutronix.de \
    --to=v.strassheim@linutronix.de \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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;
as well as URLs for NNTP newsgroup(s).