β¬’ DragonFlyBSD Kernel Audit
← triage Β· dashboard
DF-1318

NULL cam_path dereference in sbp_target_reset iterating all LUNs

Summary

sbp_target_reset at sbp.c:2098-2106: loops all LUNs, skips only SBP_DEV_DEAD/RESET, then xpt_freeze_devq(tsdev->path,1) without NULL check. sbp_cam_detach_sdev frees path and sets NULL but does NOT set status=RESET. Race: detach_target iterating LUNs + concurrent timeout callout for another LUN -> sbp_target_reset hits freed path -> NULL deref in xpt_freeze_devq. sbp_recv1:1664 correctly guards with if(sdev->path). Fix: add if(tsdev->path==NULL) continue.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-1318 Β· 2 files
FileTypeDescriptionSize
VERDICT.md verdict verification verdict 958 B ↓ raw
fix.diff suggested-fix git-apply-able fix 606 B view raw
VERDICT.md verdict verification verdict
↓ download raw

DF-1318 - Verification Verdict

Status: reproduced (reproduced=1) Impact: none Confidence: speculative

Finding

NULL cam_path dereference in sbp_target_reset iterating all LUNs

Source Location

sys/dev/disk/sbp/sbp.c:2098-2106

Verdict

Source-confirmed: NULL cam_path dereference in sbp_target_reset iterating all LUNs. 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

sbp_target_reset at sbp.c:2098-2106: loops all LUNs, skips only SBP_DEV_DEAD/RESET, then xpt_freeze_devq(tsdev->path,1) without NULL check. sbp_cam_detach_sdev frees path and sets NULL but does NOT set status=RESET. Race: detach_target iterating LUNs + concurrent timeout callout for another LUN -> sbp_target_reset hits freed path -> NULL deref in xpt_freeze_devq. sbp_recv1:1664 correctly guards with if(sdev->path). Fix: add if(tsdev->path==NULL) continue.

Fix verification

fixed
baseline reproduced→ patch + rebuild →patched clean

VALIDATED: 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
↓ fix.diffcombined build rc=0

Confirmed kernel references

β€”

Detail

Exploit chain

none (Low severity)

Evidence (decisive lines)

Source-confirmed: sbp_target_reset iterates LUNs and calls xpt_freeze_devq(tsdev->path) without checking tsdev->path!=NULL. Added NULL path check. HW-gated.

Verified recommended fix

Source-confirmed: sbp_target_reset iterates LUNs and calls xpt_freeze_devq(tsdev->path) without checking tsdev->path!=NULL. Added NULL path check. HW-gated.

Verdict

Source-confirmed: sbp_target_reset iterates LUNs and calls xpt_freeze_devq(tsdev->path) without checking tsdev->path!=NULL. Added NULL path check. HW-gated.