CVE-2026-90384: iomap: release the folio batch on iomap callback failures
In the Linux kernel, the following vulnerability has been resolved:
iomap: release the folio batch on iomap callback failures
A sashiko review of an unrelated patch points out that the folio batch mechanism used for iomap zero range fails to release the batch in a couple error scenarios. If either calls to ->iomapend() or ->iomapbegin() fail, the direct return paths bypass the batch cleanup.
The ->iomapend() case is not a practical issue at the moment because there is no user of the mechanism that returns an error from this path. The ->iomapbegin() case is theoretically possible because XFS can invoke the fill helper and error out at various points thereafter. This subtly complicates things because XFS does not transfer iomapflags to the iomap data structure in the error path.
To deal with both of these issues, first make sure to invoke the cleanup helper in the error path for either fs callback. Second, update the helper to clear the flag unconditionally and release the batch so long as it is populated. This more clearly delineates the purpose of the flag to control the I/O path and not necessarily the status of the fbatch, so add a comment around this as well.
Affected Software
Event History
Frequently Asked Questions
What conditions could trigger the unreleased folio batch?
The issue can occur during iomap zero-range processing when an iomap callback fails. The practically relevant path is a failure from ->iomap_begin(); XFS can invoke the fill helper and then encounter an error.
Is failure from ->iomap_end() currently a practical exposure?
No current user of this mechanism returns an error from ->iomap_end(), so that path is not considered a practical issue at present. The fix nevertheless adds cleanup for errors from either callback.
What does the fix change?
The fix invokes the folio-batch cleanup helper on error paths from ->iomap_begin() and ->iomap_end(). It also clears the relevant flag unconditionally and releases the batch whenever it is populated.