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

Parent DMA tag sc->fc.dmat never destroyed in detach

Summary

bus_dma_tag_create allocates parent DMA tag sc->fc.dmat in fwohci_pci_attach at :319 but fwohci_pci_detach (:341-386) never calls bus_dma_tag_destroy for it. All child DMA tags properly destroyed via fwohci_db_free and fwdma_free (fwdma.c:113/216 both call bus_dma_tag_destroy for child tags). sc->fc.dmat also never set to NULL so stale pointer persists. On every detach (hot-unplug, kldunload, devctl) one bus_dma_tag_t leaks. Also affects error-path detaches from within attach. Repeated attach/detach cycles gradually exhaust kernel DMA-tag memory.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-1099 Β· 3 files
FileTypeDescriptionSize
VERDICT.md verdict Source-confirmation verdict for DF-1099 612 B ↓ raw
fix.diff suggested-fix Destroy parent DMA tag in fwohci_pci_detach 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-1099
↓ download raw

DF-1099 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: Destroy parent DMA tag in fwohci_pci_detach

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 allocates parent DMA tag sc->fc.dmat but detach never calls bus_dma_tag_destroy; tag and any child tags leak across reload.

Verified recommended fix

REPRODUCED (source-only): fwohci_pci_attach allocates parent DMA tag sc->fc.dmat but detach never calls bus_dma_tag_destroy; tag and any child tags leak across reload.

Verdict

REPRODUCED (source-only): fwohci_pci_attach allocates parent DMA tag sc->fc.dmat but detach never calls bus_dma_tag_destroy; tag and any child tags leak across reload.