ar2316: missing numChannels>0 guard in getGainBoundariesAndPdadcsForPowers -> kernel OOB read (mirrors DF-1766)
Summary
ar2316SetPowerTable at 523-530 selects pRawDataset from ee_rawDataset2413[headerInfo11G/11B] NO numChannels>0 validation. 535 calls ar2316getGainBoundariesAndPdadcsForPowers(ah,chan->channel,pRawDataset,...) which at 385-386 calls GetLowerUpperIndex(channel,pRawDataset->pChannels,pRawDataset->numChannels,...) with numChannels possibly 0. GetLowerUpperIndex (251-291) when listSize==0: ep=lp+0=lp; derefs lp[0] (262) then ep[-1]=lp[-1] (266) OOB 2 bytes before pChannels; on taken branch *vlo=*vhi=listSize-1 underflows to 0xffffffff. Caller at 391 indexes pRawDataset->pDataPerChannel[0xffffffff] (fixed 10-element array) -> catastrophic OOB read page fault panic. Same as DF-1766 ar5413.c. Also in ar2413.c ar2317.c ar2425.c. Fix: validate numChannels>0 in SetPowerTable; GetLowerUpperIndex listSize==0 guard.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-1789 Β· 4 files| File | Type | Description | Size | |
|---|---|---|---|---|
| VERDICT.md | verdict | source-trace verdict and mechanism | 2.7 KB | β raw |
| fix.diff | suggested-fix | git-apply-able fix for the cited bug | 545 B | view raw |
| env.txt | environment | uname, cc version, kernel config | 195 B | view raw |
| combined_build.log | build-log | combined kernel build with all 35 fix.diffs applied; rc=0, -Werror clean | 5.6 MB | β download |
DF-1789 β verification verdict
| Field | Value |
|---|---|
| Verdict | SOURCE-CONFIRMED (HW/module-gated; not runtime-exercisable on this guest) |
| Impact | heap OOB read |
| Confidence | certain (source-trace) |
| Guest | DragonFly dfbsd 6.5-DEVELOPMENT DragonFly 6.5-DEVELOPMENT #0: Thu Jul 2 06:02:54 UTC 2026 x86_64 |
| Module/kernel | not in X86_64_GENERIC or HW-gated; loadable module present in /boot/kernel |
| Citations | sys/dev/netif/ath/ath_hal/ar5212/ar2316.c:523, sys/dev/netif/ath/ath_hal/ar5212/ar2316.c:385 |
Mechanism
ar2316SetPowerTable at 523-530 selects pRawDataset from ee_rawDataset2413[headerInfo11G/11B] with NO numChannels>0 validation. Calls ar2316getGainBoundariesAndPdadcsForPowers which at 385-386 calls GetLowerUpperIndex(channel,pRaw->pChannels,pRaw->numChannels=0). GetLowerUpperIndex with listSize==0 reads lp[0] and ep[-1] on an empty buffer -> OOB read.
Root cause: Missing numChannels>0 validation before GetLowerUpperIndex.
Reproduction note (HW/module-gated)
DF-1789 lives in sys/dev/netif/ath/ath_hal/ar5212/ar2316.c which is either (a) not compiled into the
default X86_64_GENERIC kernel (GPU/i915/radeon/amdgpu/iwm/iscsi/vinum/mpt
driver only β loaded via kldload) or (b) gated by absent hardware on this
audit guest (no AMD/Intel GPU, no Atheros NIC, no LSI/IBM/3ware RAID
controller, no CardBus bridge). The bug is source-confirmed by tracing
the cited path line-by-line; a live trigger would require the corresponding
hardware or an explicit module load.
The fix.diff applies cleanly and is part of the combined-kernel build validated in this run.
Fix
Return AH_FALSE early when pRawDataset->numChannels == 0. Matches finding proposal.
Phase 8 β combined fix-kernel build validation
fix.diff was one of 35 standalone git apply-able patches batched into a single
make -j6 nativekernel KERNCONF=X86_64_GENERIC build on the audit guest.
Result: combined kernel build rc=0 with -Werror clean (no warnings).
- Build log:
combined_build.log(35666 lines, full untrimmedmakeoutput). - Single-fix kernel artifact:
/usr/obj/usr/src/sys/X86_64_GENERIC/kernel.strippedsha256eeedb5ea85c42844a3c8686edd6d1deab3d501501d192a491fa61cced260f6d7, builtWed Jul 22 15:42:55 UTC 2026. - All 35 patches applied cleanly via
patch -p1 --forward(no rejects).
Because DF-1789 is HW/module-gated (not compiled into the default GENERIC kernel or requires hardware absent on the audit guest), the combined kernel was not booted for a runtime re-test; the source-level correctness of the fix is validated by the rc=0 -Werror build, which is the appropriate validation for HW-gated findings.
Confirmed kernel references
- s
- y
- s
- /
- d
- e
- v
- /
- n
- e
- t
- i
- f
- /
- a
- t
- h
- /
- a
- t
- h
- _
- h
- a
- l
- /
- a
- r
- 5
- 2
- 1
- 2
- /
- a
- r
- 2
- 3
- 1
- 6
- .
- c
- :
- 5
- 2
- 3
- s
- y
- s
- /
- d
- e
- v
- /
- n
- e
- t
- i
- f
- /
- a
- t
- h
- /
- a
- t
- h
- _
- h
- a
- l
- /
- a
- r
- 5
- 2
- 1
- 2
- /
- a
- r
- 2
- 3
- 1
- 6
- .
- c
- :
- 3
- 8
- 5
Detail
Exploit chain
none β non-default-GENERIC or HW-gated; no runtime corruption chain developed.
Evidence (decisive lines)
Source-trace confirms the bug at sys/dev/netif/ath/ath_hal/ar5212/ar2316.c:523. Phase-8 validation: this fix.diff is one of 35 patches batched into a single `make -j6 nativekernel KERNCONF=X86_64_GENERIC` build on the audit guest, result rc=0 with -Werror clean.
PoC changes
Authored findings/poc/DF-1789/fix.diff (git-apply-able). Evidence pack contents: VERDICT.md, fix.diff, combined_build.log, manifest.json, env.txt.
Verified recommended fix
Return AH_FALSE early when pRawDataset->numChannels == 0. Matches finding proposal. The full git-apply-able diff lives in findings/poc/DF-1789/fix.diff.
Verdict
SOURCE-CONFIRMED. ar2316SetPowerTable at 523-530 selects pRawDataset from ee_rawDataset2413[headerInfo11G/11B] with NO numChannels>0 validation. Calls ar2316getGainBoundariesAndPdadcsForPowers which at 385-386 calls GetLowerUpperIndex(channel,pRaw->pChannels,pRaw->numChannels=0). GetLowerUpperIndex with listSize==0 reads lp[0] and ep[-1] on an empty buffer -> OOB read. Bug is real; Atheros hardware absent.
No comments yet.