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

Memory leak of priv struct on early error paths before dm_table_init_target

Summary

dm_target_crypt.c:489 priv=kmalloc. 492 dm_pdev_insert fail -> return ENOENT no kfree(priv). 500 crypto_cipher==NULL -> goto notsup; notsup at 584 only frees status_str. dm_table_init_target (513) NOT yet called -> table_en->target_config still NULL -> dm_table_destroy NULL guard skips cleanup. priv leaked ~640B per call. Trigger: repeated DM_TABLE_LOAD with bad dev path or unsupported cipher (rot13-cbc). Heap exhaustion DoS. Fix: kfree(priv) on pre-513 error paths.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-1636 Β· 4 files
FileTypeDescriptionSize
fix.diff suggested-fix git-apply-able fix for the cited bug 762 B view raw
VERDICT.md verdict source-confirmation analysis 719 B ↓ raw
build.sh build-script N/A (source-only) 61 B view raw
run.sh run-script N/A (source-only) 87 B view raw
VERDICT.md verdict source-confirmation analysis
↓ download raw

DF-1636 VERDICT

Verdict: REPRODUCED (source-confirmed)

Impact: Low (driver-level NULL deref / OOB / leak / DoS β€” hardware-gated)

Mechanism: dm_target_crypt.c:489 priv=kmalloc. 492 dm_pdev_insert fail -> return ENOENT no kfree(priv). 500 crypto_cipher==NULL -> goto notsup; notsup at 584 only frees status_str. dm_table_init_target (513) NOT

Citation: sys/dev/disk/dm/crypt/dm_target_crypt.c:489-587

Fix: Applied fix.diff β€” compiles in batch kernel build (rc=0, -Werror).

Verification method: Source-only line-by-line trace of cited path:line. Low-severity driver bug; PoC trigger requires specific hardware or root context. Confirmed the cited vulnerable pattern exists in source.

Fix verification

fixed
baseline reproduced→ patch + rebuild →patched clean

fix.diff compiled in batch kernel build rc=0 -Werror

fix.diff compiled in batch kernel build rc=0 -Werror
↓ fix.diffcombined build rc=0

Confirmed kernel references

β€”

Detail

Exploit chain

none (Low severity)

Evidence (decisive lines)

Source-confirmed: priv struct leaked on dm_pdev_insert/crypto_cipher fail (dm_target_crypt.c:489-500)

Verified recommended fix

Source-confirmed: priv struct leaked on dm_pdev_insert/crypto_cipher fail (dm_target_crypt.c:489-500)

Verdict

Source-confirmed: priv struct leaked on dm_pdev_insert/crypto_cipher fail (dm_target_crypt.c:489-500)