From: sashiko-bot@kernel.org
To: "Daniel Machon" <daniel.machon@microchip.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net-next v5 06/13] net: lan966x: add FDMA ops dispatch for PCIe support
Date: Sat, 30 May 2026 00:44:38 +0000 [thread overview]
Message-ID: <20260530004438.CBC4B1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260520-lan966x-pci-fdma-v5-6-ca56197ae05b@microchip.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Race condition leading to NULL pointer dereference, and improper error cleanup causing active NAPI deletion during probe.
--
commit 451c636b2ada8ed9e0353b85f81b6fd1d9682b69
Author: Daniel Machon <daniel.machon@microchip.com>
net: lan966x: add FDMA ops dispatch for PCIe support
This commit introduces an ops table for FDMA operations to support
different implementations for platform and PCIe instances. It plumbs
the various FDMA functions through this new ops structure.
> diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
> --- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
> +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
[ ... ]
> @@ -1234,7 +1249,7 @@ static int lan966x_probe(struct platform_device *pdev)
> if (err)
> goto cleanup_fdb;
>
> - err = lan966x_fdma_init(lan966x);
> + err = lan966x->ops->fdma_init(lan966x);
> if (err)
> goto cleanup_ptp;
[Severity: High]
This isn't a bug introduced by this patch, but looking at the probe
sequence, could this late initialization of FDMA lead to a NULL pointer
dereference?
Earlier in lan966x_probe(), the ports are initialized and
lan966x_fdma_netdev_init() is called, which in turn calls napi_enable().
The FDMA interrupt is also requested early.
Since the FDMA queue backing memory isn't allocated until
lan966x->ops->fdma_init() is called here, what happens if an interrupt fires
before this point? It appears the interrupt handler could schedule the NAPI
instance, and the poll routine would execute fdma_has_frames(), which then
dereferences the unallocated fdma->dcbs pointer.
>
> @@ -1247,7 +1262,7 @@ static int lan966x_probe(struct platform_device *pdev)
> return 0;
>
> cleanup_fdma:
> - lan966x_fdma_deinit(lan966x);
> + lan966x->ops->fdma_deinit(lan966x);
>
> cleanup_ptp:
> lan966x_ptp_deinit(lan966x);
[Severity: High]
This is a pre-existing issue, but does skipping fdma_deinit() here leave
the NAPI instance enabled during the rest of the error cleanup?
When jumping to cleanup_ptp, it skips the fdma_deinit() call which would
normally disable NAPI. The cleanup path eventually reaches
lan966x_fdma_netdev_deinit(), which calls netif_napi_del() on the
still-enabled NAPI structure.
Does this create a use-after-free vulnerability in softnet_data.poll_list by
deleting an active NAPI structure?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260520-lan966x-pci-fdma-v5-0-ca56197ae05b@microchip.com?part=6
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
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 [this message]
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=20260530004438.CBC4B1F00893@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.