From: sashiko-bot@kernel.org
To: "Daniel Machon" <daniel.machon@microchip.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net-next v6 04/14] net: lan966x: add FDMA LLP register write helper
Date: Thu, 10 Sep 2026 13:01:49 +0000 [thread overview]
Message-ID: <20260910130149.B5BC11F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260909-lan966x-pci-fdma-v6-4-6f48dab9d671@microchip.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] Unchecked return value of `fdma_dcbs_init` in `lan966x_fdma_rx_alloc` leads to missing pages, causing a guaranteed NULL pointer dereference during teardown or reload.
- [High] Hardware and software RX ring pointers become permanently desynchronized on the `lan966x_fdma_reload` failure path, breaking RX completely.
--
commit 3d957750cc640b40763313c06874bd2261200dd3
Author: Daniel Machon <daniel.machon@microchip.com>
net: lan966x: add FDMA LLP register write helper
Move the FDMA Link List Pointer (LLP) register writes into a new shared
helper and call it from the allocation functions instead of the activate
and start functions. This avoids overwriting ATU-translated addresses
with DMA addresses in the upcoming PCIe FDMA path.
> diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c
> index 41d4ec7f2f571..b8344fd5e5ad2 100644
> --- a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c
> +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c
[ ... ]
> @@ -128,6 +135,8 @@ static int lan966x_fdma_rx_alloc(struct lan966x_rx *rx)
> fdma_dcbs_init(fdma, FDMA_DCB_INFO_DATAL(fdma->db_size),
> FDMA_DCB_STATUS_INTR);
>
> + lan966x_fdma_llp_configure(lan966x, fdma->dma, fdma->channel_id);
> +
> return 0;
> }
[Severity: High]
This is a pre-existing issue, but I noticed the return value of
fdma_dcbs_init() is ignored here in lan966x_fdma_rx_alloc().
If page allocation fails under memory pressure inside
lan966x_fdma_rx_dataptr_cb(), fdma_dcbs_init() aborts early and
returns -ENOMEM. The remaining rx->page[i][j] entries are left as NULL,
but since the error is ignored, initialization succeeds with an
incomplete ring.
Does this lead to a NULL pointer dereference in
lan966x_fdma_rx_free_pages() when the interface is brought down or an
MTU reload fails? That function blindly loops over all fdma->n_dcbs and
passes each page to page_pool_put_full_page() which will crash when trying
to access the page's reference count.
[ ... ]
> @@ -876,6 +871,9 @@ static int lan966x_fdma_reload(struct lan966x *lan966x, int new_mtu)
> MEM_TYPE_PAGE_POOL, page_pool);
> }
>
> + lan966x_fdma_llp_configure(lan966x, lan966x->rx.fdma.dma,
> + lan966x->rx.fdma.channel_id);
> +
> lan966x_fdma_rx_start(&lan966x->rx);
>
> lan966x_fdma_wakeup_netdev(lan966x);
[Severity: High]
This isn't a bug introduced by this patch, but does calling
lan966x_fdma_llp_configure() here in the restore: path of
lan966x_fdma_reload() cause the hardware and software ring pointers to
become permanently desynchronized?
The restore: path successfully restores the old rx->fdma state to memory
(via memcpy), reverting software's dcb_index to wherever it was before
the reload attempt. However, configuring the LLP register here forces the
hardware back to the start of the ring (index 0).
When lan966x_fdma_rx_start() starts the engine, hardware will write newly
received frames sequentially from index 0, but the software NAPI poll
(lan966x_fdma_napi_poll) will still poll the restored dcb_index. Can this
cause all newly received packets to be missed and stall the ring entirely
once the hardware wraps around and encounters the already 'done'
descriptors from its first pass?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260909-lan966x-pci-fdma-v6-0-6f48dab9d671@microchip.com?part=4
next prev parent reply other threads:[~2026-09-10 13:01 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 13:00 [PATCH net-next v6 00/14] net: lan966x: add support for PCIe FDMA Daniel Machon
2026-09-09 13:00 ` [PATCH net-next v6 01/14] MAINTAINERS: add FDMA library to Sparx5 SoC entry Daniel Machon
2026-09-09 13:00 ` [PATCH net-next v6 02/14] net: microchip: fdma: rename contiguous dataptr helpers Daniel Machon
2026-09-09 13:00 ` [PATCH net-next v6 03/14] net: microchip: fdma: add PCIe ATU support Daniel Machon
2026-09-10 13:05 ` netdev-bot+sashiko
2026-09-14 13:57 ` Daniel Machon
2026-09-09 13:00 ` [PATCH net-next v6 04/14] net: lan966x: add FDMA LLP register write helper Daniel Machon
2026-09-10 13:01 ` sashiko-bot [this message]
2026-09-09 13:00 ` [PATCH net-next v6 05/14] net: lan966x: export FDMA helpers for reuse Daniel Machon
2026-09-09 13:00 ` [PATCH net-next v6 06/14] net: lan966x: use a dedicated device for DMA operations Daniel Machon
2026-09-10 13:01 ` sashiko-bot
2026-09-09 13:00 ` [PATCH net-next v6 07/14] net: lan966x: add FDMA ops dispatch for PCIe support Daniel Machon
2026-09-10 13:01 ` sashiko-bot
2026-09-09 13:00 ` [PATCH net-next v6 08/14] net: lan966x: clear FDMA interrupt stickies after switch reset Daniel Machon
2026-09-10 13:05 ` netdev-bot+sashiko
2026-09-14 14:09 ` Daniel Machon
2026-09-09 13:00 ` [PATCH net-next v6 09/14] net: lan966x: add shutdown callback to stop FDMA on reboot Daniel Machon
2026-09-10 13:01 ` sashiko-bot
2026-09-10 13:05 ` netdev-bot+sashiko
2026-09-14 15:06 ` Daniel Machon
2026-09-09 13:00 ` [PATCH net-next v6 10/14] net: lan966x: add PCIe FDMA support Daniel Machon
2026-09-10 13:01 ` sashiko-bot
2026-09-10 13:05 ` netdev-bot+sashiko
2026-09-15 8:54 ` Daniel Machon
2026-09-09 13:00 ` [PATCH net-next v6 11/14] net: lan966x: add PCIe FDMA MTU change support Daniel Machon
2026-09-10 13:01 ` sashiko-bot
2026-09-10 13:05 ` netdev-bot+sashiko
2026-09-15 10:23 ` Daniel Machon
2026-09-09 13:00 ` [PATCH net-next v6 12/14] net: lan966x: add PCIe FDMA XDP support Daniel Machon
2026-09-10 13:05 ` netdev-bot+sashiko
2026-09-15 10:34 ` Daniel Machon
2026-09-09 13:00 ` [PATCH net-next v6 13/14] misc: lan966x-pci: dts: extend cpu reg to cover PCIE DBI space Daniel Machon
2026-09-10 13:05 ` netdev-bot+sashiko
2026-09-15 10:38 ` Daniel Machon
2026-09-09 13:00 ` [PATCH net-next v6 14/14] misc: lan966x-pci: dts: add fdma interrupt to overlay Daniel Machon
2026-09-10 13:05 ` netdev-bot+sashiko
2026-09-15 10:52 ` 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=20260910130149.B5BC11F00893@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.