CVE-2026-100053: ublk: let STOP_DEV cancel the server's commands before its release
In the Linux kernel, the following vulnerability has been resolved:
ublk: let STOPDEV cancel the server's commands before its release
STOPDEV cancels the fetched commands after dropping ub->mutex, so STARTDEV and FETCH can run in between:
STOPDEV STARTDEV / FETCH lock ub->mutex ublkstopdevunlocked() (not started: does nothing) unlock ub->mutex STARTDEV goes live, schedules scan FETCH publishes a new command cancelworksync(scan) cancels the new disk's scan ublkcanceldev() takes the new command: NULL io->cmd on a queue which isn't canceling
A STARTDEV after STOPDEV also goes live over the canceled commands.
Hold a reference on the server's /dev/ublkcN while canceling:
STOPDEV lock ub->mutex ublkstopdevunlocked() cancelworksync(scan) server attached: take a reference on its file, set STOPPING unlock ub->mutex ublkcanceldev() drop the reference
- STOPPING makes FETCH and PREP get UBLKIORESABORT and STARTDEV -EBUSY; a STARTDEV or ENDUSERRECOVERY waiting for the device to get ready wakes up too; the reset in the server's release clears it - the release can't run before the reference is dropped, so no new server can attach, and the cancel only meets this server's commands - the cancel still runs after the unlock: iouringcmddone() may take uringlock, under which FETCH takes ub->mutex
ublkchopen() saves the file in ->chfile and ublkchrelease() clears it, under cancelmutex. The release runs after the last reference is gone, so take ours with filerefget(). Drop it with fputsync(): if it is the last one, fput() would defer the release to this task, which DELDEV then makes wait for the device to be freed.
A server which opened the device but hasn't fetched is stopped too. Document what a server sees after STOPDEV in ublk.rst.