devaddq() error path frees wrong variable leaking 1024 bytes of M_BUS on allocation pressure
Summary
devaddq bad: cleanup third kfree tests loc!=NULL instead of data!=NULL. When loc allocation fails (data already allocated) data never freed leaking 1024-byte M_BUS allocation per failed device event notification. Under sustained memory pressure accelerates exhaustion. Copy-paste error third guard re-tests loc but frees data. loc-failure path loc==NULL skips kfree(data). [VERIFIED pass2: source-confirmed data leak when loc alloc fails; data-ne-NULL fix compile-validated]
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-2545 Β· 8 files| File | Type | Description | Size | |
|---|---|---|---|---|
| VERDICT.md | β | 1.2 KB | β raw | |
| README.md | β | 226 B | β raw | |
| build.sh | β | 85 B | view raw | |
| run.sh | β | 49 B | view raw | |
| env.txt | β | 314 B | view raw | |
| manifest.json | β | 591 B | view raw | |
| verdict.json | β | 1.9 KB | view raw | |
| fix.diff | β | 210 B | view raw |
DF-2545 evidence pack
- finding: sys/kern/subr_bus.c (585-621)
- verdict: reproduced (certain) - see VERDICT.md
- source-only confirmation (no runtime PoC)
- reproduce: build.sh / run.sh
- fix.diff: present, git-apply-able
DF-2545 - Verification Verdict
Status: reproduced Impact: none (hardening) Confidence: certain
Mechanism
devaddq bad: label frees pnp and loc correctly but the third free is gated on loc != NULL instead of data != NULL; when the loc kmalloc itself failed (loc==NULL, data already allocated) the 1024-byte data buffer is leaked on every failed devctl notification.
Verdict
source-confirmed (no runtime PoC; deterministic code trace of the cited path:line in the read-only sys/ tree). Allocation-pressure-only leak (M_BUS, 1 KB per devctl event when memory is tight); logic confirmed by inspection - the copy-paste condition is unambiguous.
Threat / reachability
Latent code defect; see VERDICT.md.
Privilege escalation assessment
n/a (hardening)
Fix
if (data != NULL) kfree(data, M_BUS);
Kernel references
Fix status (batch validation)
Applied with the 36 sibling fix.diffs of this batch in findings/poc/_batch41/all_fixes.patch; single in-guest make -j6 nativekernel KERNCONF=X86_64_GENERIC completed RC=0 with zero errors under -Werror (full log: findings/poc/_batch41/fix_build8.log). Behavior A/B intentionally skipped for this Info-tier item.
Fix verification
not_testablefix.diff compile-validated in the batch combined kernel build (all 37 diffs of this batch applied to in-guest /usr/src; make -j6 nativekernel KERNCONF=X86_64_GENERIC, see batch build log referenced in VERDICT.md); no behavior A/B performed for this Info-tier item; behavior A/B intentionally skipped for Info tier
batch combined kernel build log (see findings/poc/_batch41 note in VERDICT.md)
Confirmed kernel references
Detail
Exploit chain
no escalation path (Info-tier hardening; see VERDICT.md)
Evidence (decisive lines)
VERDICT.md mechanism/verdict sections; fix.diff
PoC changes
none (source-only confirmation for this Info-tier item)
Verified recommended fix
if (data != NULL) kfree(data, M_BUS);
Verdict
source-confirmed (no runtime PoC; deterministic code trace of the cited path:line in the read-only sys/ tree). Allocation-pressure-only leak (M_BUS, 1 KB per devctl event when memory is tight); logic confirmed by inspection - the copy-paste condition is unambiguous.
No comments yet.