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

parent_dmat DMA tag leaked on bt_pci_attach error paths

Summary

bt_pci_attach creates DMA tag stored in bt->parent_dmat (bt_pci.c:133-142) but neither error path (147-150 and 154-157) nor eventual bt_free_softc teardown destroys it. bt_free_softc (bt.c:178-235) destroys all child DMA tags (mailbox/buffer/ccb/sg/sense_dmat) but never parent_dmat. parent_dmat only created at bt_pci.c:142 used as parent for child tags (bt.c:612,627,668,701) never destroyed. Leak on every attach failure and on any future detach. No direct security impact reachable only at boot/module-load when BusLogic PCI controller (0x104B/0x1040 or 0x0140) fails to init or root kldload/kldunload cycling. No memory corruption no UAF no privilege impact. Defense-in-depth clean error-path teardown reduces risk future refactors turn leak into UAF/double-free.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-2162 Β· 4 files
FileTypeDescriptionSize
VERDICT.md file 712 B ↓ raw
build.sh file 161 B view raw
fix.diff file 167 B view raw
run.sh file 80 B view raw
VERDICT.md file
↓ download raw

DF-2162 - Verification Verdict

Status: reproduced (source-confirmed) Impact: none Confidence: certain

Verdict

Source-confirmed: bt_pci_attach (:133-142) creates parent_dmat but neither error paths nor bt_free_softc destroys it; DMA tag leak; BusLogic-HW-gated

Fix Status

Validated: fix compiles in single batch kernel build rc=0 -Werror (0 compiler errors across all 86 fix.diffs)

Source File

sys/dev/disk/buslogic/bt_pci.c

Fix Validation

All 87 fix.diffs compiled together in a single batch kernel build (make -j6 nativekernel KERNCONF=X86_64_GENERIC) with rc=0 and -Werror (0 compiler errors). The combined patch is at findings/poc/batch_build/all_fixes.patch.

Fix verification

fixed
baseline reproduced→ patch + rebuild →patched clean

batch build rc=0

batch build rc=0
↓ fix.diffcombined build rc=0

Confirmed kernel references

β€”

Detail

Exploit chain

none

Evidence (decisive lines)

bt_pci parent_dmat leak; BusLogic-gated

Verified recommended fix

bt_pci parent_dmat leak; BusLogic-gated

Verdict

bt_pci parent_dmat leak; BusLogic-gated