BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Daniel Machon" <daniel.machon@microchip.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net-next v9 11/15] net: lan966x: add PCIe FDMA support
Date: Tue, 29 Sep 2026 19:35:13 +0000	[thread overview]
Message-ID: <20260929193514.5A6821F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260928-lan966x-pci-fdma-v9-11-a17caf60f89a@microchip.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] net: missing length validation in hardware offload checks leads to OOB read
--

commit 0077ede3c2cac9977be6b338e3fa7c1952aabe74
Author: Daniel Machon <daniel.machon@microchip.com>

net: lan966x: add PCIe FDMA support

Add PCIe FDMA support for lan966x. The PCIe FDMA path uses contiguous
DMA buffers mapped through the endpoint's ATU, with memcpy-based frame
transfer instead of per-page DMA mappings.

> diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma_pci.c b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma_pci.c
> new file mode 100644
> index 0000000000000..f511e70613141
> --- /dev/null
> +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma_pci.c
[ ... ]
> @@ -0,0 +1,458 @@
[ ... ]
> +static bool lan966x_fdma_pci_hw_offload(struct lan966x *lan966x, u32 port,
> +					struct sk_buff **pskb)
> +{
> +	struct sk_buff *skb = *pskb;
> +	u32 val;
> +
> +	val = lan_rd(lan966x, ANA_CPU_FWD_CFG(port));
> +	if (!(val & (ANA_CPU_FWD_CFG_IGMP_REDIR_ENA |
> +		     ANA_CPU_FWD_CFG_MLD_REDIR_ENA)))
> +		return true;
> +
> +	if (eth_type_vlan(skb->protocol)) {
> +		skb = skb_vlan_untag(skb);
> +		*pskb = skb;
> +		if (unlikely(!skb))
> +			return false;
> +	}
> +
> +	if (skb->protocol == htons(ETH_P_IP) &&
> +	    ip_hdr(skb)->protocol == IPPROTO_IGMP)
> +		return false;

[Severity: Medium]
Does this code safely handle truncated packets? If a remote attacker sends a
truncated IPv4 packet (e.g., a 14-byte Ethernet frame with the ETH_P_IP
ethertype) to the interface, eth_type_trans() consumes the MAC header, leaving
skb->len == 0.

Calling ip_hdr(skb)->protocol without first validating that the SKB payload
contains a complete IPv4 header would read past the valid payload. This
out-of-bounds read could access uninitialized SKB memory padding, leading to
unpredictable forwarding decisions.

Should there be a length check before dereferencing the IP header here?

(Note: This is a pre-existing issue in the original lan966x_hw_offload()
function in lan966x_main.c, which appears to have been duplicated here.)

> +
> +	if (IS_ENABLED(CONFIG_IPV6) &&
> +	    skb->protocol == htons(ETH_P_IPV6) &&
> +	    ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr) &&
> +	    !ipv6_mc_check_mld(skb))
> +		return false;

[Severity: Medium]
Similarly, does this IPv6 code path require a length validation before
accessing ipv6_hdr(skb)->daddr?

> +
> +	return true;
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260928-lan966x-pci-fdma-v9-0-a17caf60f89a@microchip.com?part=11

  reply	other threads:[~2026-09-29 19:35 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-28 19:32 [PATCH net-next v9 00/15] net: lan966x: add support for PCIe FDMA Daniel Machon
2026-09-28 19:32 ` [PATCH net-next v9 01/15] MAINTAINERS: add FDMA library to Sparx5 SoC entry Daniel Machon
2026-09-28 19:32 ` [PATCH net-next v9 02/15] net: microchip: fdma: rename contiguous dataptr helpers Daniel Machon
2026-09-28 19:32 ` [PATCH net-next v9 03/15] net: microchip: fdma: add PCIe ATU support Daniel Machon
2026-10-02  7:33   ` netdev-bot+sashiko
2026-09-28 19:32 ` [PATCH net-next v9 04/15] net: microchip: fdma: use little-endian types for descriptor fields Daniel Machon
2026-10-02 13:25   ` Simon Horman
2026-09-28 19:32 ` [PATCH net-next v9 05/15] net: lan966x: add FDMA LLP register write helper Daniel Machon
2026-09-28 19:32 ` [PATCH net-next v9 06/15] net: lan966x: export FDMA helpers for reuse Daniel Machon
2026-09-28 19:32 ` [PATCH net-next v9 07/15] net: lan966x: use a dedicated device for DMA operations Daniel Machon
2026-09-28 19:32 ` [PATCH net-next v9 08/15] net: lan966x: add FDMA ops dispatch for PCIe support Daniel Machon
2026-09-28 19:32 ` [PATCH net-next v9 09/15] net: lan966x: clear FDMA interrupt stickies after switch reset Daniel Machon
2026-09-28 19:32 ` [PATCH net-next v9 10/15] net: lan966x: add shutdown callback to stop the FDMA on reboot Daniel Machon
2026-10-02  7:33   ` netdev-bot+sashiko
2026-09-28 19:32 ` [PATCH net-next v9 11/15] net: lan966x: add PCIe FDMA support Daniel Machon
2026-09-29 19:35   ` sashiko-bot [this message]
2026-10-02  7:33   ` netdev-bot+sashiko
2026-10-02  9:02     ` Daniel Machon
2026-10-02 14:14   ` Simon Horman
2026-09-28 19:33 ` [PATCH net-next v9 12/15] net: lan966x: add PCIe FDMA MTU change support Daniel Machon
2026-09-29 19:35   ` sashiko-bot
2026-10-02  7:33   ` netdev-bot+sashiko
2026-10-02  9:08     ` Daniel Machon
2026-09-28 19:33 ` [PATCH net-next v9 13/15] net: lan966x: add PCIe FDMA XDP support Daniel Machon
2026-09-29 19:35   ` sashiko-bot
2026-10-02  7:33   ` netdev-bot+sashiko
2026-10-02  9:11     ` Daniel Machon
2026-09-28 19:33 ` [PATCH net-next v9 14/15] misc: lan966x-pci: dts: extend cpu reg to cover PCIE DBI space Daniel Machon
2026-10-02  7:33   ` netdev-bot+sashiko
2026-09-28 19:33 ` [PATCH net-next v9 15/15] misc: lan966x-pci: dts: add fdma interrupt to overlay Daniel Machon
2026-10-02  7:33   ` netdev-bot+sashiko
2026-10-02  9:16     ` Daniel Machon
2026-10-02 20:20 ` [PATCH net-next v9 00/15] net: lan966x: add support for PCIe FDMA patchwork-bot+netdevbpf

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=20260929193514.5A6821F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel.machon@microchip.com \
    --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