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

Missing resource cleanup when bus_dma_tag_create fails in fwohci_pci_attach

Summary

fwohci_pci_attach at fwohci_pci.c:320-324: when bus_dma_tag_create fails, returns ENOMEM without calling fwohci_pci_detach(self). By this point three resources allocated: sc->bsr (bus_alloc_resource :267), sc->irq_res (bus_alloc_resource :278), interrupt handler (bus_setup_intr :287). None freed before return. Other error paths at :282/:296/:330 correctly call fwohci_pci_detach(self). device_doattach (subr_bus.c:2108-2124) does NOT call device_detach when DEVICE_ATTACH returns non-zero so leaked resources never reclaimed. Requires bus_dma_tag_create failure under kernel memory pressure. Impact: permanent resource leak (MMIO mapping, IRQ line, interrupt handler slot) per occurrence.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-1098 Β· 3 files
FileTypeDescriptionSize
VERDICT.md verdict Source-confirmation verdict for DF-1098 621 B ↓ raw
fix.diff suggested-fix Call fwohci_pci_detach on bus_dma_tag_create failure 464 B view raw
../fix_build.log build-log Batch kernel build log (all fixes, rc=0) 5.6 MB ↓ download
VERDICT.md verdict Source-confirmation verdict for DF-1098
↓ download raw

DF-1098 Verification Verdict

Severity: Low Impact class: leak Verification method: Source-only confirmation (HW-gated, not triggerable on QEMU guest)

Verdict: REPRODUCED (source-confirmed)

The bug is confirmed in the audited source at the cited path:line. Triggerable but requires specific driver/config.

Fix: Call fwohci_pci_detach on bus_dma_tag_create failure

Fix applied and validated in batch kernel build (rc=0, -Werror).

Fix validation

All 41-fix patches batched into single make -j6 nativekernel KERNCONF=X86_64_GENERIC build. Build result: rc=0, 0 errors (full -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): fwohci_pci_attach returns ENOMEM on bus_dma_tag_create failure without calling fwohci_pci_detach, leaking sc->bsr and sc->irq_res.

Verified recommended fix

REPRODUCED (source-only): fwohci_pci_attach returns ENOMEM on bus_dma_tag_create failure without calling fwohci_pci_detach, leaking sc->bsr and sc->irq_res.

Verdict

REPRODUCED (source-only): fwohci_pci_attach returns ENOMEM on bus_dma_tag_create failure without calling fwohci_pci_detach, leaking sc->bsr and sc->irq_res.