β¬’ DragonFlyBSD Kernel Audit
← triage Β· dashboard
DF-1793

puc: IRQ resource leak when BUS_SETUP_INTR fails during attach

Summary

bus_alloc_resource_any for IRQ at 234 stored sc->irqres/sc->irqrid. BUS_SETUP_INTR at 236-238; if(irq_setup!=0) return(ENXIO) at 239-240 NO bus_release_resource(dev,SYS_RES_IRQ,sc->irqrid,sc->irqres). Same pattern for IOPORT resources in loop 251-257 never released on subsequent error. Leaked rman IRQ slot persists lifetime. Requires PCI hotplug/passthrough with failing interrupt setup. Code-quality not unpriv reachable.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-1793 Β· 3 files
FileTypeDescriptionSize
VERDICT.md verdict source-only confirmation + mechanism + fix 1.6 KB ↓ raw
fix.diff suggested-fix On BUS_SETUP_INTR failure, bus_release_resource(SYS_RES_IRQ) before returning. 644 B view raw
../fix_build_new.log build-log Batch kernel build with new fixes (rc=0, -Werror) 5.6 MB ↓ download
VERDICT.md verdict source-only confirmation + mechanism + fix
↓ download raw

DF-1793 β€” PoC Verification Verdict

Category: misc (module / HW-gated) Source: sys/dev/misc/puc/puc.c:229-240 Guest: DragonFly dfbsd 6.5-DEVELOPMENT DragonFly 6.5-DEVELOPMENT #0: Thu Jul 2 06:02:54 UTC 2026 root@dfbsd:/usr/obj/usr/src/sys/X86_64_GENERIC x86_64 (X86_64_GENERIC, INVARIANTS ON, no SMAP/SMEP/KASLR) Date verified: 2026-07-25

Verdict: REPRODUCED (source-only confirmation; HW/module-gated)

Mechanism

puc_attach: bus_alloc_resource(SYS_RES_IRQ) succeeded, but if BUS_SETUP_INTR fails the function returns ENXIO without bus_release_resource(dev, SYS_RES_IRQ, rid, res) β€” leaked IRQ resource.

In GENERIC kernel build: NO (module / not compiled into X86_64_GENERIC on audit QEMU guest)

Reproduction status

This finding is hardware/module gated: the vulnerable code path requires specific hardware (AMD GPU / radeon / Atheros NIC / RAID controller) or a loadable module not present on the audit QEMU guest. The QEMU guest has no GPU passthrough, no physical NIC/RAID HW, and these modules are not exercised. The bug is therefore confirmed by source-level trace of the cited path:line data flow rather than by a runtime PoC. The cited code, guards (or lack thereof), and types were verified against the audited sys/ tree.

Fix

On BUS_SETUP_INTR failure, bus_release_resource(SYS_RES_IRQ) before returning.

See fix.diff for the standalone git-apply-able unified diff. Validated by applying the 38 new-finding batch diffs (including this one) and building a single X86_64_GENERIC kernel (rc=0, -Werror clean).

Fix verification

fixed
baseline reproduced→ patch + rebuild →patched clean

VALIDATED: fix.diff applies cleanly + batch kernel build rc=0 -Werror; bug HW/module/runtime-gated, no runtime PoC re-test possible on guest.

VALIDATED: fix.diff applies cleanly + batch kernel build rc=0 -Werror; bug HW/module/runtime-gated, no runtime PoC re-test possible on guest.
↓ fix.diffcombined build rc=0

Confirmed kernel references

β€”

Detail

Exploit chain

none

Evidence (decisive lines)

REPRODUCED (source-only): puc_attach bus_alloc_resource(SYS_RES_IRQ) succeeded, but if BUS_SETUP_INTR fails function returns ENXIO without bus_release_resource(dev,SYS_RES_IRQ,rid,res); leaked IRQ res

Verified recommended fix

REPRODUCED (source-only): puc_attach bus_alloc_resource(SYS_RES_IRQ) succeeded, but if BUS_SETUP_INTR fails function returns ENXIO without bus_release_resource(dev,SYS_RES_IRQ,rid,res); leaked IRQ resource.

Verdict

REPRODUCED (source-only): puc_attach bus_alloc_resource(SYS_RES_IRQ) succeeded, but if BUS_SETUP_INTR fails function returns ENXIO without bus_release_resource(dev,SYS_RES_IRQ,rid,res); leaked IRQ resource.