Broken error path in i915_gem_prime_import leaks dma_buf_attachment
Summary
i915_gem_dmabuf.c:305 calls dma_buf_attach; lines 313-317 check obj==NULL goto fail_detach; fail_detach label (336-340) has body dma_buf_detach+dma_buf_put entirely inside #if 0 #endif so jumping does nothing. Compare upstream-correct drm_prime.c:755-761 drm_gem_prime_import_dev which calls dma_buf_detach+put on same error path. Currently masked: DragonFly dma_buf_attach is stub returning NULL. Latent unbounded kernel-memory leak activates when dma_buf_attach implemented: i915_gem_object_alloc failure after attach succeeds leaks struct dma_buf_attachment. Trigger: PRIME_FD_TO_HANDLE cross-device under memory pressure. AV:L/PR:L/AC:L, A:L.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-2042 Β· 3 files| File | Type | Description | Size | |
|---|---|---|---|---|
| VERDICT.md | verdict | Source-confirmation verdict for DF-2042 | 627 B | β raw |
| fix.diff | suggested-fix | Enable dma_buf_detach cleanup on error path (remove #if 0) | 312 B | view raw |
| ../fix_build.log | build-log | Batch kernel build log (all fixes, rc=0) | 5.6 MB | β download |
DF-2042 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: Enable dma_buf_detach cleanup on error path (remove #if 0)
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
fixedVALIDATED: 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.
Confirmed kernel references
β
Detail
Exploit chain
none
Evidence (decisive lines)
REPRODUCED (source-only): i915_gem_dmabuf fail_detach label body (dma_buf_detach+dma_buf_put) entirely inside #if 0; jumping to it does nothing; dma_buf attach leak.
Verified recommended fix
REPRODUCED (source-only): i915_gem_dmabuf fail_detach label body (dma_buf_detach+dma_buf_put) entirely inside #if 0; jumping to it does nothing; dma_buf attach leak.
Verdict
REPRODUCED (source-only): i915_gem_dmabuf fail_detach label body (dma_buf_detach+dma_buf_put) entirely inside #if 0; jumping to it does nothing; dma_buf attach leak.
No comments yet.