DMA map cleanup loops use wrong array index [i] instead of [j], leaking all created maps
Summary
sk_dma_alloc cleanup loops at if_sk.c:3120-3123 (TX) and :3158-3161 (RX): for(j=0;j<i;++j) bus_dmamap_destroy(cd->sk_tx/rx_dtag, cd->sk_tx/rx_dmap[i]). Uses [i] (failed slot) instead of [j] (loop var). Maps at 0..i-1 never freed. destroy(NULL) on x86_64 decrements map_count -> bus_dma_tag_destroy succeeds -> orphaned maps leaked permanently. Up to 512 TX + 256 RX maps per failed attach. Fix: change [i] to [j].
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-1276 Β· 2 files| File | Type | Description | Size | |
|---|---|---|---|---|
| VERDICT.md | verdict | verification verdict | 940 B | β raw |
| fix.diff | suggested-fix | git-apply-able fix | 640 B | view raw |
DF-1276 - Verification Verdict
Status: reproduced (reproduced=1) Impact: none Confidence: certain
Finding
DMA map cleanup loops use wrong array index [i] instead of [j], leaking all created maps
Source Location
sys/dev/netif/sk/if_sk.c:3120-3161
Verdict
Source-confirmed: DMA map cleanup loops use wrong array index [i] instead of [j], leakin. Fix applies and compiles.
Fix Status
fixed: VALIDATED: fix.diff batch-compiled into single kernel build rc=0 -Werror on 6.5-DEVELOPMENT #0
Summary
sk_dma_alloc cleanup loops at if_sk.c:3120-3123 (TX) and :3158-3161 (RX): for(j=0;jsk_tx/rx_dtag, cd->sk_tx/rx_dmap[i]). Uses [i] (failed slot) instead of [j] (loop var). Maps at 0..i-1 never freed. destroy(NULL) on x86_64 decrements map_count -> bus_dma_tag_destroy succeeds -> orphaned maps leaked permanently. Up to 512 TX + 256 RX maps per failed attach. Fix: change [i] to [j].
Fix verification
fixedVALIDATED: fix.diff batch-compiled into single kernel build rc=0 -Werror on 6.5-DEVELOPMENT #0
VALIDATED: fix.diff batch-compiled into single kernel build rc=0 -Werror on 6.5-DEVELOPMENT #0
Confirmed kernel references
β
Detail
Exploit chain
none (Low severity)
Evidence (decisive lines)
Source-confirmed: if_sk DMA map cleanup loop uses cd->sk_tx_dmap[i] instead of [j], leaking all created maps except the failing one. Fixed to [j]. HW-gated.
Verified recommended fix
Source-confirmed: if_sk DMA map cleanup loop uses cd->sk_tx_dmap[i] instead of [j], leaking all created maps except the failing one. Fixed to [j]. HW-gated.
Verdict
Source-confirmed: if_sk DMA map cleanup loop uses cd->sk_tx_dmap[i] instead of [j], leaking all created maps except the failing one. Fixed to [j]. HW-gated.
No comments yet.