From: sashiko-bot@kernel.org
To: "Daniel Machon" <daniel.machon@microchip.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net-next v8 13/15] net: lan966x: add PCIe FDMA XDP support
Date: Fri, 25 Sep 2026 19:59:11 +0000 [thread overview]
Message-ID: <20260925195912.0DB771F00899@smtp.kernel.org> (raw)
In-Reply-To: <20260924-lan966x-pci-fdma-v8-13-201c7b707d8b@microchip.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] net: XDP program shrinking frame below ETH_HLEN causes OOB read in eth_type_trans()
--
commit 65038b88aa7eb3b2b7d79cb17c606497fae0582c
Author: Daniel Machon <daniel.machon@microchip.com>
net: lan966x: add PCIe FDMA XDP support
This commit adds XDP support for the PCIe FDMA path in the lan966x driver.
The implementation operates on contiguous ATU-mapped buffers with
memcpy-based XDP_TX, and updates the receive path to handle frame lengths
returned by the XDP program.
> diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma_pci.c b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma_pci.c
> index 7185e65dda435..216e9cbcd1580 100644
> --- a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma_pci.c
> +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma_pci.c
[ ... ]
> @@ -136,7 +138,123 @@ static bool lan966x_fdma_pci_rx_size_fits(struct fdma *fdma, u32 blockl)
[ ... ]
> +static int lan966x_xdp_pci_run(struct lan966x_port *port, void *data,
> + u32 data_len, void **xdp_data, u32 *xdp_len)
> +{
[ ... ]
> + act = bpf_prog_run_xdp(xdp_prog, &xdp);
> +
> + *xdp_data = xdp.data;
> + *xdp_len = xdp.data_end - xdp.data;
> +
> + switch (act) {
> + case XDP_PASS:
> + return FDMA_PASS;
[Severity: High]
Does this code allow an XDP program to shrink the frame size below the
minimum Ethernet header size (ETH_HLEN)?
If the loaded XDP program shrinks the packet and returns XDP_PASS,
the modified length is accepted here and passed along to the driver's
receive handling without bounds checking to ensure it is at least ETH_HLEN.
[ ... ]
> @@ -168,38 +286,33 @@ static int lan966x_fdma_pci_rx_check_frame(struct lan966x_rx *rx, u64 *src_port)
[ ... ]
> static struct sk_buff *lan966x_fdma_pci_rx_get_frame(struct lan966x_rx *rx,
> - u64 src_port)
> + u64 src_port, void *data,
> + u32 data_len)
> {
[ ... ]
> - memcpy(skb->data,
> - fdma_dataptr_virt_addr_contiguous(fdma,
> - fdma->dcb_index,
> - fdma->db_index),
> - data_len);
> + memcpy(skb->data, data, data_len);
>
> skb_put(skb, data_len);
>
> skb->dev = lan966x->ports[src_port]->dev;
> - skb_pull(skb, IFH_LEN_BYTES);
> -
> - skb_trim(skb, skb->len - ETH_FCS_LEN);
>
> skb->protocol = eth_type_trans(skb, skb->dev);
[Severity: High]
If data_len was shrunk below ETH_HLEN by the XDP program, will this sequence
cause an out-of-bounds read and potential kernel crash?
eth_type_trans() unconditionally pulls ETH_HLEN bytes from the SKB. Passing
a truncated data_len < ETH_HLEN to skb_put() followed by eth_type_trans()
will read uninitialized memory and can corrupt skb boundaries.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260924-lan966x-pci-fdma-v8-0-201c7b707d8b@microchip.com?part=13
next prev parent reply other threads:[~2026-09-25 19:59 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-24 19:56 [PATCH net-next v8 00/15] net: lan966x: add support for PCIe FDMA Daniel Machon
2026-09-24 19:56 ` [PATCH net-next v8 01/15] MAINTAINERS: add FDMA library to Sparx5 SoC entry Daniel Machon
2026-09-24 19:56 ` [PATCH net-next v8 02/15] net: microchip: fdma: rename contiguous dataptr helpers Daniel Machon
2026-09-24 19:56 ` [PATCH net-next v8 03/15] net: microchip: fdma: add PCIe ATU support Daniel Machon
2026-09-25 20:52 ` netdev-bot+sashiko
2026-09-24 19:56 ` [PATCH net-next v8 04/15] net: microchip: fdma: use little-endian types for descriptor fields Daniel Machon
2026-09-24 19:56 ` [PATCH net-next v8 05/15] net: lan966x: add FDMA LLP register write helper Daniel Machon
2026-09-24 19:56 ` [PATCH net-next v8 06/15] net: lan966x: export FDMA helpers for reuse Daniel Machon
2026-09-24 19:56 ` [PATCH net-next v8 07/15] net: lan966x: use a dedicated device for DMA operations Daniel Machon
2026-09-24 19:56 ` [PATCH net-next v8 08/15] net: lan966x: add FDMA ops dispatch for PCIe support Daniel Machon
2026-09-24 19:56 ` [PATCH net-next v8 09/15] net: lan966x: clear FDMA interrupt stickies after switch reset Daniel Machon
2026-09-25 20:52 ` netdev-bot+sashiko
2026-09-24 19:56 ` [PATCH net-next v8 10/15] net: lan966x: add shutdown callback to stop the FDMA on reboot Daniel Machon
2026-09-25 19:59 ` sashiko-bot
2026-09-25 20:52 ` netdev-bot+sashiko
2026-09-24 19:56 ` [PATCH net-next v8 11/15] net: lan966x: add PCIe FDMA support Daniel Machon
2026-09-25 19:59 ` sashiko-bot
2026-09-25 20:52 ` netdev-bot+sashiko
2026-09-24 19:57 ` [PATCH net-next v8 12/15] net: lan966x: add PCIe FDMA MTU change support Daniel Machon
2026-09-25 20:52 ` netdev-bot+sashiko
2026-09-24 19:57 ` [PATCH net-next v8 13/15] net: lan966x: add PCIe FDMA XDP support Daniel Machon
2026-09-25 19:59 ` sashiko-bot [this message]
2026-09-25 20:52 ` netdev-bot+sashiko
2026-09-28 11:02 ` Daniel Machon
2026-09-24 19:57 ` [PATCH net-next v8 14/15] misc: lan966x-pci: dts: extend cpu reg to cover PCIE DBI space Daniel Machon
2026-09-25 20:52 ` netdev-bot+sashiko
2026-09-24 19:57 ` [PATCH net-next v8 15/15] misc: lan966x-pci: dts: add fdma interrupt to overlay Daniel Machon
2026-09-25 20:52 ` 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=20260925195912.0DB771F00899@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 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.