From: sashiko-bot@kernel.org
To: "Alex Elder" <elder@riscstar.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org,
bpf@vger.kernel.org
Subject: Re: [PATCH net-next v2 13/14] net: stmmac: tc956x: add TC956x/QPS615 support
Date: Sat, 06 Jun 2026 01:01:26 +0000 [thread overview]
Message-ID: <20260606010127.1484A1F00899@smtp.kernel.org> (raw)
In-Reply-To: <20260605010022.968612-14-elder@riscstar.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] Leaked IRQ mappings and potential Use-After-Free on the probe error path if IRQ mapping or resource initialization fails.
- [High] Uninitialized stack variables passed to `devm_irq_domain_instantiate()` can cause a kernel panic or memory corruption.
- [Low] Invalid Makefile rule referencing a non-existent Kconfig symbol and missing file.
--
commit 55f951da9fbefea49a26410638dbb60af63d2658
Author: Daniel Thompson <daniel@riscstar.com>
net: stmmac: tc956x: add TC956x/QPS615 support
Toshiba TC956x is an Ethernet AVB/TSN bridge and is essentially a small
and highly-specialized SoC. This commit adds a driver for the eMAC/MSIGEN
combination found on these devices.
> diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile
> index a1cea2f57252e..e8e7f95dbe3e8 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/Makefile
> +++ b/drivers/net/ethernet/stmicro/stmmac/Makefile
> @@ -51,4 +51,6 @@ obj-$(CONFIG_STMMAC_PCI) += stmmac-pci.o
> obj-$(CONFIG_DWMAC_INTEL) += dwmac-intel.o
> obj-$(CONFIG_DWMAC_LOONGSON) += dwmac-loongson.o
> obj-$(CONFIG_DWMAC_MOTORCOMM) += dwmac-motorcomm.o
> +obj-$(CONFIG_TC956X_PCI) += tc956x-pci.o
[Severity: Low]
Is this line a leftover from a previous iteration? The correct Kconfig
symbol appears to be CONFIG_TOSHIBA_TC956X_PCI, and the source file
tc956x_pci.c was placed in drivers/misc/ rather than the stmmac directory.
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-tc956x.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-tc956x.c
> new file mode 100644
> index 0000000000000..c77585e4a50e6
> --- /dev/null
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-tc956x.c
[ ... ]
> +/* We have one IRQ chip instance with 25 IRQs in its domain */
> +static struct irq_domain *
> +tc956x_msigen_irq_domain_instantiate(struct tc956x_data *td)
> +{
> + struct irq_domain_chip_generic_info dgc_info;
> + struct irq_domain_info info;
[Severity: High]
Does this pass uninitialized stack variables to the core IRQ domain subsystem?
These local variables are declared on the stack without zero-initialization.
Since only a subset of their fields are populated before passing them to
devm_irq_domain_instantiate(), fields like info.fwnode and info.parent could
contain arbitrary stack garbage.
If the core IRQ domain subsystem tries to dereference a garbage pointer in
info.fwnode, could it lead to memory corruption or a page fault during probe?
> +
> + dgc_info.name = devm_kasprintf(td->dev, GFP_KERNEL, "tc956x-msigen-%d",
> + td->auxbus_data->mac_id);
[ ... ]
> + info.init = tc956x_msigen_irq_domain_init;
> + info.exit = tc956x_msigen_irq_domain_exit;
> +
> + return devm_irq_domain_instantiate(td->dev, &info);
> +}
[ ... ]
> +static int tc956x_stmmac_resources_init(struct tc956x_data *td)
> +{
> + struct irq_domain *irq_domain = td->irq_domain;
> + struct stmmac_resources *res = &td->res;
> + u32 i;
> +
> + res->irq = irq_create_mapping(irq_domain, HWIRQ_EVENT);
> + if (!res->irq)
> + return -EINVAL;
> +
> + for (i = 0; i < td->plat->tx_queues_to_use; i++) {
> + res->tx_irq[i] = irq_create_mapping(irq_domain, HWIRQ_TX0 + i);
> + if (!res->tx_irq[i])
> + return -EINVAL;
[Severity: High]
If irq_create_mapping() fails here or in the RX loop below, this returns
an error without unwinding previously successful mappings.
When the caller tc956x_dwmac_probe() encounters this error:
tc956x_dwmac_probe() {
...
ret = tc956x_stmmac_resources_init(td);
if (ret) {
ret = dev_err_probe(dev, ret,
"failed to initialize stmmac resources\n");
goto err_put_mdio;
}
...
}
It jumps to err_put_mdio, bypassing tc956x_stmmac_resources_exit() entirely.
Since devres will automatically free the irq_domain on probe failure, will the
undisposed mappings cause a kernel warning and leave undisposed irq_desc
structures pointing to the freed domain, leading to a use-after-free?
> + }
> +
> + for (i = 0; i < td->plat->rx_queues_to_use; i++) {
> + res->rx_irq[i] = irq_create_mapping(irq_domain, HWIRQ_RX0 + i);
> + if (!res->rx_irq[i])
> + return -EINVAL;
> + }
> +
> + res->addr = td->auxbus_data->emac;
> +
> + return 0;
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260605010022.968612-1-elder@riscstar.com?part=13
next prev parent reply other threads:[~2026-06-06 1:01 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-05 1:00 [PATCH net-next v2 00/14] net: enable TC956x support Alex Elder
2026-06-05 1:00 ` [PATCH net-next v2 01/14] dt-bindings: net: qca,qca808x: Add regulator properties Alex Elder
2026-06-06 1:01 ` sashiko-bot
2026-06-09 20:38 ` Alex Elder
2026-06-05 1:00 ` [PATCH net-next v2 02/14] net: phy: qcom: qca808x: Add regulator management Alex Elder
2026-06-06 1:01 ` sashiko-bot
2026-06-08 8:07 ` Linus Walleij
2026-06-05 1:00 ` [PATCH net-next v2 03/14] net: pcs: pcs-xpcs-regmap: support XPCS memory-mapped MDIO bus via regmap Alex Elder
2026-06-05 15:35 ` Maxime Chevallier
2026-06-09 19:31 ` Alex Elder
2026-06-06 1:01 ` sashiko-bot
2026-06-09 20:38 ` Alex Elder
2026-06-07 17:47 ` Andrew Lunn
2026-06-05 1:00 ` [PATCH net-next v2 04/14] net: pcs: xpcs: re-order xpcs_pre_config() to update after the reset Alex Elder
2026-06-05 1:00 ` [PATCH net-next v2 05/14] net: pcs: pcs-xpcs: select operating mode for 10G-baseR capable PCS Alex Elder
2026-06-06 1:01 ` sashiko-bot
2026-06-07 17:52 ` Andrew Lunn
2026-06-05 1:00 ` [PATCH net-next v2 06/14] net: stmmac: dma: create a separate dma_device pointer Alex Elder
2026-06-06 1:01 ` sashiko-bot
2026-06-05 1:00 ` [PATCH net-next v2 07/14] net: stmmac: dwxgmac2: Add multi MSI interrupt mode Alex Elder
2026-06-05 1:00 ` [PATCH net-next v2 08/14] net: stmmac: dwxgmac2: Add XGMAC 3.01a support Alex Elder
2026-06-05 1:00 ` [PATCH net-next v2 09/14] net: stmmac: dwxgmac2: export symbols for XGMAC 3.01a DMA Alex Elder
2026-06-05 1:00 ` [PATCH net-next v2 10/14] dt-bindings: net: toshiba,tc9654-dwmac: add TC9564 Ethernet bridge Alex Elder
2026-06-05 2:40 ` Rob Herring (Arm)
2026-06-05 12:24 ` Alex Elder
2026-06-05 14:40 ` Rob Herring
2026-06-09 21:31 ` Alex Elder
2026-06-06 1:01 ` sashiko-bot
2026-06-05 1:00 ` [PATCH net-next v2 11/14] misc: tc956x_pci: add TC956x/QPS615 support Alex Elder
2026-06-06 1:01 ` sashiko-bot
2026-06-05 1:00 ` [PATCH net-next v2 12/14] gpio: tc956x: " Alex Elder
2026-06-06 1:01 ` sashiko-bot
2026-06-08 11:52 ` Bartosz Golaszewski
2026-06-05 1:00 ` [PATCH net-next v2 13/14] net: stmmac: " Alex Elder
2026-06-05 14:47 ` Rob Herring
2026-06-09 21:31 ` Alex Elder
2026-06-05 16:05 ` Maxime Chevallier
2026-06-09 19:32 ` Alex Elder
2026-06-06 1:01 ` sashiko-bot [this message]
2026-06-05 1:00 ` [PATCH net-next v2 14/14] arm64: dts: qcom: qcs6490-rb3gen2: enable TC9564 with a single QCA8081 phy Alex Elder
2026-06-06 1:01 ` sashiko-bot
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=20260606010127.1484A1F00899@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=elder@riscstar.com \
--cc=robh@kernel.org \
--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.