From: sashiko-bot@kernel.org
To: "Daniel Machon" <daniel.machon@microchip.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net-next v5 05/13] net: lan966x: export FDMA helpers for reuse
Date: Sat, 30 May 2026 00:44:35 +0000 [thread overview]
Message-ID: <20260530004435.C27B01F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260520-lan966x-pci-fdma-v5-5-ca56197ae05b@microchip.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
Pre-existing issues:
- [High] Missing dma_wmb() when appending new DMA descriptors to an active ring.
- [High] Lack of endianness conversions for hardware DMA descriptor fields, incompatible with PCIe on Big-Endian hosts.
- [High] Missing bounds validation on hardware-provided length before calling skb_put(), risking kernel panic.
--
commit 71ed27dbfea60bc58684878c1afb6584c28b04fb
Author: Daniel Machon <daniel.machon@microchip.com>
net: lan966x: export FDMA helpers for reuse
This patch makes shared FDMA helpers non-static to allow their reuse by the
PCIe FDMA implementation.
> diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c
> index 6c5761e886d47..25e673bdf0841 100644
> --- a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c
> +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c
[ ... ]
> @@ -471,7 +471,7 @@ static struct sk_buff *lan966x_fdma_rx_get_frame(struct lan966x_rx *rx,
> return NULL;
> }
>
> -static int lan966x_fdma_napi_poll(struct napi_struct *napi, int weight)
> +int lan966x_fdma_napi_poll(struct napi_struct *napi, int weight)
> {
[Severity: High]
This isn't a bug introduced by this patch, but since this helper is being
exported for PCIe reuse, does the platform RX path need bounds validation on
the hardware-provided length?
In lan966x_fdma_rx_get_frame() (called by this NAPI poll function), the
packet length is extracted directly from the hardware descriptor and passed
unconditionally to skb_put():
skb_put(skb, FDMA_DCB_STATUS_BLOCKL(db->status));
If the hardware returns a length exceeding the allocated SKB data region
minus the XDP headroom, skb_put() will extend the tail beyond skb->end,
resulting in an immediate skb_over_panic(). Should the length be validated
against the available headroom and at least IFH_LEN_BYTES before calling
skb_pull()?
[Severity: High]
This is a pre-existing issue, but since the FDMA implementation is being
exposed for PCIe, could the lack of endianness conversions cause issues on
Big-Endian hosts?
PCIe endpoints use strictly little-endian DMA descriptors. However, the driver
defines descriptor fields (like status and dataptr in struct fdma_db) as
native u64 and accesses them using native bitwise macros.
If this code runs on a Big-Endian architecture with the PCIe device, will the
CPU read and write the status word in Big-Endian, causing the Little-Endian
hardware to interpret it incorrectly and fail?
[Severity: High]
This is a pre-existing issue, but is there a missing dma_wmb() when appending
new DMA descriptors to an active ring?
When lan966x_fdma_napi_poll() allocates new pages, it calls fdma_dcb_add()
which initializes the new descriptor's contents and then updates the previous
descriptor's nextptr to link it.
There doesn't appear to be a dma_wmb() executed between writing the new
descriptor's status/data pointers and updating the previous descriptor's
nextptr. Without this barrier, could the CPU reorder the memory writes,
allowing the hardware DMA engine to follow the updated nextptr and read the
new descriptor before its data and status fields are fully written to memory?
> struct lan966x *lan966x = container_of(napi, struct lan966x, napi);
> struct lan966x_rx *rx = &lan966x->rx;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260520-lan966x-pci-fdma-v5-0-ca56197ae05b@microchip.com?part=5
next prev parent reply other threads:[~2026-05-30 0:44 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-20 8:12 [PATCH net-next v5 00/13] net: lan966x: add support for PCIe FDMA Daniel Machon
2026-05-20 8:12 ` [PATCH net-next v5 01/13] MAINTAINERS: add FDMA library to Sparx5 SoC entry Daniel Machon
2026-05-20 8:12 ` [PATCH net-next v5 02/13] net: microchip: fdma: rename contiguous dataptr helpers Daniel Machon
2026-05-20 8:12 ` [PATCH net-next v5 03/13] net: microchip: fdma: add PCIe ATU support Daniel Machon
2026-05-30 0:44 ` sashiko-bot
2026-05-20 8:12 ` [PATCH net-next v5 04/13] net: lan966x: add FDMA LLP register write helper Daniel Machon
2026-05-30 0:44 ` sashiko-bot
2026-05-20 8:12 ` [PATCH net-next v5 05/13] net: lan966x: export FDMA helpers for reuse Daniel Machon
2026-05-30 0:44 ` sashiko-bot [this message]
2026-05-20 8:12 ` [PATCH net-next v5 06/13] net: lan966x: add FDMA ops dispatch for PCIe support Daniel Machon
2026-05-30 0:44 ` sashiko-bot
2026-05-20 8:12 ` [PATCH net-next v5 07/13] net: lan966x: clear FDMA interrupt stickies after switch reset Daniel Machon
2026-05-20 8:12 ` [PATCH net-next v5 08/13] net: lan966x: add shutdown callback to stop FDMA on reboot Daniel Machon
2026-05-23 1:45 ` Jakub Kicinski
2026-05-30 0:44 ` sashiko-bot
2026-05-20 8:12 ` [PATCH net-next v5 09/13] net: lan966x: add PCIe FDMA support Daniel Machon
2026-05-23 1:56 ` Jakub Kicinski
2026-05-30 0:44 ` sashiko-bot
2026-05-20 8:12 ` [PATCH net-next v5 10/13] net: lan966x: add PCIe FDMA MTU change support Daniel Machon
2026-05-30 0:44 ` sashiko-bot
2026-05-20 8:12 ` [PATCH net-next v5 11/13] net: lan966x: add PCIe FDMA XDP support Daniel Machon
2026-05-23 2:01 ` Jakub Kicinski
2026-05-20 8:12 ` [PATCH net-next v5 12/13] misc: lan966x-pci: dts: extend cpu reg to cover PCIE DBI space Daniel Machon
2026-05-23 2:01 ` Jakub Kicinski
2026-05-20 8:12 ` [PATCH net-next v5 13/13] misc: lan966x-pci: dts: add fdma interrupt to overlay Daniel Machon
2026-05-21 14:12 ` [PATCH net-next v5 00/13] net: lan966x: add support for PCIe FDMA Daniel Machon
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=20260530004435.C27B01F00893@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.