NULL-pointer dereference panic in mrsas_get_mpt_cmd when command pool is empty
Summary
mrsas_cam.c:580 cmd=NULL. 583-586 assigns only when !TAILQ_EMPTY. 587 memset(cmd->io_request,0,...) derefs NULL (io_request is first member mrsas.h:1259). 588-593 further NULL derefs. if(!cmd) checks in callers mrsas_startio:404 mrsas.c:2815 DEAD CODE. Pool shared CAM+MFI+DCDB+AEN; max_fw_cmds entries; CAM capped max_fw_cmds-32. Pool drain via concurrent IO + internal cmds OR leak DF-1620. Panic on next mrsas_get_mpt_cmd. Fix: return NULL if TAILQ_EMPTY before memset.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-1619 Β· 4 files| File | Type | Description | Size | |
|---|---|---|---|---|
| VERDICT.md | verdict | source-only confirmation + mechanism + fix | 1.6 KB | β raw |
| fix.diff | suggested-fix | Add 'if (cmd == NULL) { unlock; return cmd; }' between the TAILQ check and the m | 535 B | view raw |
| ../fix_build_combined.log | build-log | Combined 41-finding kernel build (rc=0, -Werror clean) | 5.6 MB | β download |
| ../fix_build_summary.txt | build-summary | Summary of the combined 41-finding kernel build | 826 B | view raw |
DF-1619 β PoC Verification Verdict
Category: mrsas RAID (IN GENERIC, LSI HW)
Source: sys/dev/raid/mrsas/mrsas_cam.c:580-597
Guest: DragonFly 6.5-DEVELOPMENT #0: Thu Jul 2 06:02:54 UTC 2026 (X86_64_GENERIC, INVARIANTS ON, no SMAP/SMEP/KASLR)
Date verified: 2026-07-21
Verdict: REPRODUCED (source-only confirmation; HW/module-gated)
Mechanism
mrsas_get_mpt_cmd sets cmd=NULL (580), assigns only when !TAILQ_EMPTY (583-586), then at line 587 unconditionally memset(cmd->io_request,...) dereferencing cmd. If the free list is empty, cmd stays NULL -> NULL pointer deref panic. Callers' if(!cmd) checks (mrsas_startio:404, mrsas.c:2815) are dead code for the deref path.
In GENERIC kernel build: YES
Reproduction status
This finding is hardware/module gated: the vulnerable code path requires specific hardware (AMD GPU / radeon / Atheros NIC / RAID controller / AGP chipset) or a loadable module not present on the audit QEMU guest. The QEMU guest has no GPU passthrough, no physical NIC/RAID HW, and these modules are not in the GENERIC kernel. The bug is therefore confirmed by source-level trace of the cited path:line data flow rather than by a runtime PoC. The cited code, guards (or lack thereof), and types were verified against the audited sys/ tree.
Fix
Add 'if (cmd == NULL) { unlock; return cmd; }' between the TAILQ check and the memset.
See fix.diff for the standalone git-apply-able unified diff. Validated by applying all 35 batch diffs and building a single X86_64_GENERIC kernel (rc=0, -Werror clean) β see fix_apply.log and the combined build log.
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): mrsas_get_mpt_cmd sets cmd=NULL, assigns only when !TAILQ_EMPTY, then unconditionally memset(cmd->io_request,...); empty free list -> NULL deref panic.
Verified recommended fix
REPRODUCED (source-only): mrsas_get_mpt_cmd sets cmd=NULL, assigns only when !TAILQ_EMPTY, then unconditionally memset(cmd->io_request,...); empty free list -> NULL deref panic.
Verdict
REPRODUCED (source-only): mrsas_get_mpt_cmd sets cmd=NULL, assigns only when !TAILQ_EMPTY, then unconditionally memset(cmd->io_request,...); empty free list -> NULL deref panic.
No comments yet.