CVE-2025-38141: dm: fix dm_blk_report_zones
In the Linux kernel, the following vulnerability has been resolved:
dm: fix dmblkreportzones
If dmgetlivetable() returned NULL, dmputlivetable() was never called. Also, it is possible that md->zonerevalidatemap will change while calling this function. Only read it once, so that we are always using the same value. Otherwise we might miss a call to dmputlivetable().
Finally, while md->zonerevalidatemap is set and a process is calling blkrevalidatediskzones() to set up the zone append emulation resources, it is possible that another process, perhaps triggered by blkdevreportzonesioctl(), will call dmblkreportzones(). If blkrevalidatediskzones() fails, these resources can be freed while the other process is still using them, causing a use-after-free error.
blkrevalidatediskzones() will only ever be called when initially setting up the zone append emulation resources, such as when setting up a zoned dm-crypt table for the first time. Further table swaps will not set md->zonerevalidatemap or call blkrevalidatediskzones(). However it must be called using the new table (referenced by md->zonerevalidatemap) and the new queue limits while the DM device is suspended. dmblkreportzones() needs some way to distinguish between a call from blkrevalidatediskzones(), which must be allowed to use md->zonerevalidatemap to access this not yet activated table, and all other calls to dmblkreportzones(), which should not be allowed while the device is suspended and cannot use md->zonerevalidatemap, since the zone resources might be freed by the process currently calling blkrevalidatediskzones().
Solve this by tracking the process that sets md->zonerevalidatemap in dmrevalidatezones() and only allowing that process to make use of it in dmblkreportzones().
Other sources
In the Linux kernel, the following vulnerability has been resolved:
dm: fix dmblkreportzones
If dmgetlivetable() returned NULL, dmputlivetable() was never called. Also, it is possible that md-zonerevalidatemap will change while calling this function. Only read it once, so that we are always using the same value. Otherwise we might miss a call to dmputlivetable().
Finally, while md-zonerevalidatemap is set and a process is calling blkrevalidatediskzones() to set up the zone append emulation resources, it is possible that another process, perhaps triggered by blkdevreportzonesioctl(), will call dmblkreportzones(). If blkrevalidatediskzones() fails, these resources can be freed while the other process is still using them, causing a use-after-free error.
blkrevalidatediskzones() will only ever be called when initially setting up the zone append emulation resources, such as when setting up a zoned dm-crypt table for the first time. Further table swaps will not set md-zonerevalidatemap or call blkrevalidatediskzones(). However it must be called using the new table (referenced by md-zonerevalidatemap) and the new queue limits while the DM device is suspended. dmblkreportzones() needs some way to distinguish between a call from blkrevalidatediskzones(), which must be allowed to use md-zonerevalidatemap to access this not yet activated table, and all other calls to dmblkreportzones(), which should not be allowed while the device is suspended and cannot use md-zonerevalidatemap, since the zone resources might be freed by the process currently calling blkrevalidatediskzones().
Solve this by tracking the process that sets md-zonerevalidatemap in dmrevalidatezones() and only allowing that process to make use of it in dmblkreportzones().
— IBM
Affected Software
Event History
Frequently Asked Questions
What is the severity of CVE-2025-38141?
CVE-2025-38141 has been classified as a high severity vulnerability in the Linux kernel.
How do I fix CVE-2025-38141?
To mitigate CVE-2025-38141, ensure you update to the latest stable version of the Linux kernel where the vulnerability has been addressed.
What impact does CVE-2025-38141 have on affected systems?
The impact of CVE-2025-38141 can result in potential data corruption or instability in systems using the affected Linux kernel versions.
Which versions of the Linux kernel are affected by CVE-2025-38141?
CVE-2025-38141 affects multiple versions of the Linux kernel prior to the fix being applied in the stable releases.
Is there a workaround for CVE-2025-38141?
While waiting for a patch, consider minimizing the use of affected features or configurations that trigger the vulnerability.