Skip to contentSkip to conversation

net: bcmasp: avoid refcount drain on probe

PATCH Applied Wang Haoran 3 participants 3 messages Nov 19 – Nov 25

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: bcmasp: avoid refcount drain on probe

bcmasp_probe() calls of_find_node_by_name(dev->of_node, "ethernet-ports"), which unconditionally drops the from-node reference the caller never held. Every probe or bind cycle that reaches the port scan, including ones that later fail with "No ports found", drains the asp node refcount by one. Once it hits zero, of_node_release() deadlocks in its error printk (%pOF on the parent while holding devtree_lock with IRQs off), so the machine freezes silently with nothing on the console.

Use of_get_child_by_name() which leaves the parent reference alone.

Fixes 490cb412007d ("net: bcmasp: Add support for ASP2.0 Ethernet controller")

---

drivers/net/ethernet/broadcom/asp2/bcmasp.c +1 -1
index a59a006cea3a..af9e14214987 100644
@@ -1342,7 +1342,7 @@ static int bcmasp_probe(struct platform_device *pdev)
 
 	bcmasp_init_wol(priv);
 
-	ports_node = of_find_node_by_name(dev->of_node, "ethernet-ports");
+	ports_node = of_get_child_by_name(dev->of_node, "ethernet-ports");
 	if (!ports_node) {
 		dev_warn(dev, "No ports found\n");
 		ret = -EINVAL;

---

PoC reproduction (7.4.0-rc2, arm64 QEMU virt, unmodified kernel):

Device tree injection, spliced into the QEMU virt machine DT:

    reserved-memory { #address-cells = <2>; #size-cells = <2>; ranges;
        asp-regs@7f000000 { no-map; reg = <0x0 0x7f000000 0x0 0x200000>; }; };

    asp@7f000000 { compatible = "brcm,asp-v2.2"; reg = <0x0 0x7f000000 0x0 0x200000>;
        interrupt-parent = <&gpio0>; interrupts = <4 2>; };

The node has no ethernet-ports child, so every probe passes through the of_find_node_by_name() call and then fails with "No ports found".

Trigger (repeated bind cycles):

    modprobe bcm-asp
    echo "7f000000.asp" > /sys/bus/platform/drivers/brcm,asp-v2/bind
    echo "7f000000.asp" > /sys/bus/platform/drivers/brcm,asp-v2/bind

Result:

    brcm,asp-v2 7f000000.asp: Failed to init WoL irq: -6
    brcm,asp-v2 7f000000.asp: No ports found
    MARK: probe1 done
    MARK: bind -> probe2
    MARK: bind -> probe3
    (no further output)

The third probe drives the asp node refcount to zero and the machine freezes inside of_node_release().

Control: with the same DT minus the interrupt properties the probe fails before this call and three or more bind cycles run clean.

Note: the PoC was generated with AI assistance and the vulnerability was found by static analysis. The device tree is trusted input (a bad DT requires root or physical access), so this is not a security fix, but it prevents a potential resource leak or system failure on a failed probe or an old or malformed DT.

#1 lore raw
This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:

Hi!

This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:

- How the issue was discovered, e.g. hit in production, hit during development, syzbot report, manual code inspection, LLM or static analysis tool scan.

- Whether the issue was actually triggered, or is only theoretical (e.g. found by LLM and not proven at runtime). If it was triggered please include the symptoms, like the stack trace or kernel messages.

- What hardware the change was tested on. For driver fixes please mention the device (and if relevant firmware version) used for testing, or say that the change was not tested on real hardware.

Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account.

*IMPORTANT*: If you do repost (for other reasons) - please include the relevant info in the cover letter or commit messages.

Signature · 2 lines
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
#2 lore raw
In reply to Wang Haoran
This patch was applied to netdev/net.git (main) by Willem de Bruijn <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Willem de Bruijn <[email protected]>:

Quoted 9 lines · On Thu, 19 Nov 2026 16:15:02 +0800 you wrote:

bcmasp_probe() calls of_find_node_by_name(dev->of_node, "ethernet-ports"), which unconditionally drops the from-node reference the caller never held. Every probe or bind cycle that reaches the port scan, including ones that later fail with "No ports found", drains the asp node refcount by one. Once it hits zero, of_node_release() deadlocks in its error printk (%pOF on the parent while holding devtree_lock with IRQs off), so the machine freezes silently with nothing on the console.

[...]

Here is the summary with links:
- net: bcmasp: avoid refcount drain on probe

    https://git.kernel.org/netdev/net/c/846a6d0982be

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html