All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jens Emil Schulz Østergaard" <jensemil.schulzostergaard@microchip.com>
Cc: conor+dt@kernel.org, robh@kernel.org, devicetree@vger.kernel.org,
	wsa+renesas@sang-engineering.com
Subject: Re: [PATCH net-next v14 1/9] net: dsa: add tag driver for LAN9645X
Date: Fri, 09 Oct 2026 09:06:33 +0000	[thread overview]
Message-ID: <sashiko-outbox-165121@kernel.org> (raw)
In-Reply-To: <20261008-dsa_lan9645x_switch_driver_base-v14-1-3d2a72661213@microchip.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] net/dsa: lan9645x: Stale skb->mac_header and skb->network_header after vlan_remove_tag()
--

commit 2bf43370c466c901725bcb460aaa53654797d172
Author: Jens Emil Schulz Østergaard <jensemil.schulzostergaard@microchip.com>
Subject: net: dsa: add tag driver for LAN9645X

This commit adds a tag driver for the LAN9645x family of switches, using a
front port configured as an NPI port for CPU traffic. It handles frame
extraction and injection using internal frame headers and prefix formatting.

Link: None provided

> diff --git a/net/dsa/tag_lan9645x.c b/net/dsa/tag_lan9645x.c
> new file mode 100644
> index 0000000000000..00339daecfcbd
> --- /dev/null
> +++ b/net/dsa/tag_lan9645x.c
[ ... ]
> +static struct sk_buff *lan9645x_xmit_get_vlan_info(struct sk_buff *skb,
> +						   struct net_device *br,
> +						   u32 *vlan_tci,
> +						   u32 *tag_type)
> +{
[ ... ]
> +		hdr = skb_vlan_eth_hdr(skb);
> +		if (ntohs(hdr->h_vlan_proto) == proto &&
> +		    ntohs(hdr->h_vlan_TCI) & VLAN_VID_MASK) {
> +			vlan_remove_tag(skb, &tci);
> +			*vlan_tci = tci;

[Severity: Medium]
When calling vlan_remove_tag() here, are the skb mac_header and
network_header metadata offsets left pointing to stale locations?

The vlan_remove_tag() function removes the vlan tag and moves the payload,
but it expects the caller to update skb->mac_header and skb->network_header.
This is why the standard helper __skb_vlan_pop() is usually preferred.

Because this tag driver does not adjust skb->mac_header, the offset becomes
stale. After lan9645x_xmit() pushes the 28-byte internal frame header,
won't skb_mac_header(skb) incorrectly point to bytes inside the new header
rather than the actual start of the destination address?

If the conduit device driver or network stack relies on skb_mac_header(skb)
for transmit processing, this could cause it to read incorrect bytes for
packets that had a vlan tag stripped.

> +		}
> +	}
> +
> +	*tag_type = (proto != ETH_P_8021Q) ? LAN9645X_IFH_TAG_TYPE_S :
> +					     LAN9645X_IFH_TAG_TYPE_C;
> +
> +	return skb;
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261008-dsa_lan9645x_switch_driver_base-v14-0-3d2a72661213@microchip.com?part=1

  reply	other threads:[~2026-10-09  9:06 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-08  9:05 [PATCH net-next v14 0/9] net: dsa: add DSA support for the LAN9645x switch chip family Jens Emil Schulz Østergaard
2026-10-08  9:05 ` [PATCH net-next v14 1/9] net: dsa: add tag driver for LAN9645X Jens Emil Schulz Østergaard
2026-10-09  9:06   ` sashiko-bot [this message]
2026-10-12 11:24   ` netdev-bot+sashiko
2026-10-08  9:05 ` [PATCH net-next v14 2/9] dt-bindings: net: dsa: add Microchip LAN9645x switch Jens Emil Schulz Østergaard
2026-10-08 20:29   ` Rob Herring (Arm)
2026-10-12 11:24   ` netdev-bot+sashiko
2026-10-08  9:05 ` [PATCH net-next v14 3/9] net: dsa: lan9645x: add autogenerated register macros Jens Emil Schulz Østergaard
2026-10-08  9:05 ` [PATCH net-next v14 4/9] net: dsa: lan9645x: add basic dsa driver for LAN9645X Jens Emil Schulz Østergaard
2026-10-12 11:24   ` netdev-bot+sashiko
2026-10-08  9:05 ` [PATCH net-next v14 5/9] net: dsa: lan9645x: add vlan support Jens Emil Schulz Østergaard
2026-10-12 11:24   ` netdev-bot+sashiko
2026-10-08  9:05 ` [PATCH net-next v14 6/9] net: dsa: lan9645x: add mac table integration Jens Emil Schulz Østergaard
2026-10-08  9:05 ` [PATCH net-next v14 7/9] net: dsa: lan9645x: add mdb management Jens Emil Schulz Østergaard
2026-10-12 11:24   ` netdev-bot+sashiko
2026-10-08  9:05 ` [PATCH net-next v14 8/9] net: dsa: lan9645x: add bridge support Jens Emil Schulz Østergaard
2026-10-12 11:24   ` netdev-bot+sashiko
2026-10-08  9:05 ` [PATCH net-next v14 9/9] net: dsa: lan9645x: add port statistics Jens Emil Schulz Østergaard
2026-10-09  9:06   ` sashiko-bot
2026-10-12 11:24   ` netdev-bot+sashiko

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-165121@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jensemil.schulzostergaard@microchip.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=wsa+renesas@sang-engineering.com \
    /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.