# DF-2500 — In-flight ATA requests outlive atapi_cam_detach -> atapi_cb UAF

## Verdict
NOT REPRODUCED (hardware / trigger gated). The cited vulnerable code path exists
in `sys/dev/disk/nata/atapi-cam.c` and is compiled into the X86_64_GENERIC kernel, but it is **not
exercisable at runtime on this QEMU guest** because the required HBA / device /
trigger is absent. Confidence in the source bug itself: **certain**.

## Why it cannot be reproduced here (the gate)
Trigger-gated: natapicam is active, but the UAF requires detach (hot-unplug) while an XPT_SCSI_IO is outstanding to the ATA layer. Requires host-level device removal during active I/O -- not exercisable on a fixed DVD-ROM.

See `env.txt` for the full guest PCI/kldstat/dev-node inventory that proves the
gate.

## The bug is real in source (traced line-by-line)
Cited path:
- sys/dev/disk/nata/atapi-cam.c:619
- sys/dev/disk/nata/atapi-cam.c:634
- sys/dev/disk/nata/atapi-cam.c:637-639
- sys/dev/disk/nata/atapi-cam.c:875-906
- The vulnerable construct is present verbatim in the current master source
  (confirmed by direct read of the cited lines during verification).
- A defense-in-depth `fix.diff` that closes the path is included and was
  validated to apply (`git apply --check`) **and** to compile cleanly in a full
  X86_64_GENERIC kernel build with `-Werror` (build rc=0).

## Fix
The structural part (TAILQ_FOREACH_MUTABLE in free_softc) ships in DF-2499's fix.diff. The complete fix additionally needs ata_fail_requests on the channel to abort in-flight ATA requests before the hcbs are freed.

The standalone git-apply-able diff is `fix.diff`.

## Reproduce
`./build.sh && ./run.sh` — both are no-ops on this guest by design (the gate
holds). Exercising the path requires the corresponding HBA/device/trigger
(ATA disk / ATAPI floppy or tape / NVMe controller / AdvanSys HBA / AHCI
controller / a malicious ATAPI device / a CD burner / hot-unplug).

## Status
status: not_reproduced  | reproduced: 0 | impact: none (HW-gated)
fix_status: not_testable (path cannot run on this guest; diff applies + compiles)
