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

Kernel panic on device attach error path: bus_release_resource uses wrong rid for io resource

Summary

Error-cleanup label bad: releases io resource with rid=0 (dpt_pci.c:175 bus_release_resource(dev,iotype,0,io)) but io was allocated with rid=DPT_PCI_IOADDR (0x10) or rid=DPT_PCI_MEMADDR (0x14). PCI bus resource list stores entry under original rid. resource_list_find(rl,type,0) returns NULL because no SYS_RES_IOPORT/SYS_RES_MEMORY entry has rid=0 (only SYS_RES_IRQ entry has rid=0). resource_list_release (subr_bus.c:2737) panics resource_list_release: cant find resource. Every error path after io allocation (irq alloc failure IDE controller mapping check dpt_alloc/dpt_init/dma_tag_create/bus_setup_intr failure) triggers this panic. Local rid variable overwritten to 0 at line 103 for IRQ allocation losing original io rid. Attacker: physical DPT SmartRAID PCI controller (vendor 0x1044 device 0xa400) malfunctioning during attach kernel auto-probes at boot/hot-plug causing panic instead of graceful device skip; or root kldload dpt on system with failing DPT HW. Impact kernel panic DoS. No code execution/priv-esc/info-leak. Not reachable by unprivileged local users PCI enumeration kernel-internal.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

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

DF-2151 - Verification Verdict

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

Verdict

Source-confirmed: dpt_pci bad: label (:175) releases io with rid=0 but io allocated with rid=DPT_PCI_IOADDR(0x10)/MEMADDR(0x14); wrong rid β†’ resource leak; DPT-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/raid/dpt/dpt_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)

dpt_pci bad label wrong rid; DPT-gated

Verified recommended fix

dpt_pci bad label wrong rid; DPT-gated

Verdict

dpt_pci bad label wrong rid; DPT-gated