mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] net: bcmasp: avoid refcount drain on probe
@ 2026-11-19  8:15 Wang Haoran
  2026-11-19  8:18 ` netdev-bot+sinfo
  0 siblings, 1 reply; 2+ messages in thread
From: Wang Haoran @ 2026-11-19  8:15 UTC (permalink / raw)
  To: justin.chen, florian.fainelli
  Cc: andrew+netdev, davem, edumazet, kuba, pabeni,
	bcm-kernel-feedback-list, netdev, linux-kernel, wanghr2026

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.

Signed-off-by: Wang Haoran <wanghr2026@mail.zgclab.edu.cn>
Fixes: 490cb412007d ("net: bcmasp: Add support for ASP2.0 Ethernet controller")
---

diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp.c b/drivers/net/ethernet/broadcom/asp2/bcmasp.c
index a59a006cea3a..af9e14214987 100644
--- a/drivers/net/ethernet/broadcom/asp2/bcmasp.c
+++ b/drivers/net/ethernet/broadcom/asp2/bcmasp.c
@@ -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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: bcmasp: avoid refcount drain on probe
  2026-11-19  8:15 [PATCH] net: bcmasp: avoid refcount drain on probe Wang Haoran
@ 2026-11-19  8:18 ` netdev-bot+sinfo
  0 siblings, 0 replies; 2+ messages in thread
From: netdev-bot+sinfo @ 2026-11-19  8:18 UTC (permalink / raw)
  To: Wang Haoran
  Cc: justin.chen, florian.fainelli, andrew+netdev, davem, edumazet,
	kuba, pabeni, bcm-kernel-feedback-list, netdev, linux-kernel

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.
-- 
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-19  8:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-19  8:15 [PATCH] net: bcmasp: avoid refcount drain on probe Wang Haoran
2026-11-19  8:18 ` netdev-bot+sinfo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®