CVE-2026-139199: ceph: fix error handling when the OSD client is stopping in ceph_submit_write()
In the Linux kernel, the following vulnerability has been resolved:
ceph: fix error handling when the OSD client is stopping in cephsubmitwrite()
When cephincosdstoppingblocker() fails, cephsubmitwrite() redirties and unlocks the folios remaining in cephwbc->fbatch. However, none of those folios are locked at this point: locked folios were moved to cephwbc->pages[] and removed from the fbatch by cephprocessfoliobatch(). Unlocking them triggers VMBUGONFOLIO(!foliotestlocked(folio)) in foliounlock(), or unlocks a folio locked by another task.
This error path also returns -EIO without fully cleaning up the folios in cephwbc->pages[]: their references are never dropped, fscrypt bounce pages are never freed, the writeback congestion count is never decremented, and the pages array is leaked. cephwbc->lockedpages is also left non-zero, so cephwritepagesstart() loops back around and hits BUGON(cephwbc.lockedpages).
Leave the fbatch folios alone, as cephwritepagesstart() drops their references when releasing the batch, and unwind cephwbc->pages[] the same way writepagesfinish() would have. Abort writeback in cephwritepagesstart() instead of continuing, matching the handling of cephincosdstoppingblocker() failure on entry, as the OSD client is being torn down and further writeback cannot make progress.
An LLM was used to verify that the cleanup was comprehensive, and suggested aborting the writeback instead of continuing.