xa_close returns holding xdisk_lk and releases the wrong lock on race paths
Summary
xdisk.c:767 xa_close acquires xdisk_lk. 769-770 sc==NULL returns ENXIO WITHOUT releasing xdisk_lk -> permanent lock leak. 771-773 sc->terminating does lockmgr(&sc->lk, LK_RELEASE) releasing WRONG lock (never acquired sc->lk) AND returns without releasing xdisk_lk. Contrast xa_open (704-714) correctly releases xdisk_lk on all error paths. Once leaked every xa_open/xa_close/xdisk_attach/xaio_rcvdmsg blocks forever in lockmgr. Trigger: race where si_drv1 NULL or terminating at xa_close entry; currently unreachable but latent footgun. Fix: release xdisk_lk on both error paths.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-1570 Β· 4 files| File | Type | Description | Size | |
|---|---|---|---|---|
| fix.diff | suggested-fix | git-apply-able fix for the cited bug | 506 B | view raw |
| VERDICT.md | verdict | source-confirmation analysis | 706 B | β raw |
| build.sh | build-script | N/A (source-only) | 61 B | view raw |
| run.sh | run-script | N/A (source-only) | 87 B | view raw |
DF-1570 VERDICT
Verdict: REPRODUCED (source-confirmed)
Impact: Low (driver-level NULL deref / OOB / leak / DoS β hardware-gated)
Mechanism: xdisk.c:767 xa_close acquires xdisk_lk. 769-770 sc==NULL returns ENXIO WITHOUT releasing xdisk_lk -> permanent lock leak. 771-773 sc->terminating does lockmgr(&sc->lk, LK_RELEASE) releasing WRONG lock
Citation: sys/dev/disk/xdisk/xdisk.c:767-793
Fix: Applied fix.diff β compiles in batch kernel build (rc=0, -Werror).
Verification method: Source-only line-by-line trace of cited path:line. Low-severity driver bug; PoC trigger requires specific hardware or root context. Confirmed the cited vulnerable pattern exists in source.
Fix verification
fixedfix.diff compiled in batch kernel build rc=0 -Werror
fix.diff compiled in batch kernel build rc=0 -Werror
Confirmed kernel references
β
Detail
Exploit chain
none (Low severity)
Evidence (decisive lines)
Source-confirmed: xa_close returns holding xdisk_lk and releases wrong lock sc->lk (xdisk.c:767-773)
Verified recommended fix
Source-confirmed: xa_close returns holding xdisk_lk and releases wrong lock sc->lk (xdisk.c:767-773)
Verdict
Source-confirmed: xa_close returns holding xdisk_lk and releases wrong lock sc->lk (xdisk.c:767-773)
No comments yet.