CVE-2025-38141
Severity CVSS v4.0:
Pending analysis
Type:
Unavailable / Other
Publication date:
03/07/2025
Last modified:
03/07/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
dm: fix dm_blk_report_zones<br />
<br />
If dm_get_live_table() returned NULL, dm_put_live_table() was never<br />
called. Also, it is possible that md->zone_revalidate_map will change<br />
while calling this function. Only read it once, so that we are always<br />
using the same value. Otherwise we might miss a call to<br />
dm_put_live_table().<br />
<br />
Finally, while md->zone_revalidate_map is set and a process is calling<br />
blk_revalidate_disk_zones() to set up the zone append emulation<br />
resources, it is possible that another process, perhaps triggered by<br />
blkdev_report_zones_ioctl(), will call dm_blk_report_zones(). If<br />
blk_revalidate_disk_zones() fails, these resources can be freed while<br />
the other process is still using them, causing a use-after-free error.<br />
<br />
blk_revalidate_disk_zones() will only ever be called when initially<br />
setting up the zone append emulation resources, such as when setting up<br />
a zoned dm-crypt table for the first time. Further table swaps will not<br />
set md->zone_revalidate_map or call blk_revalidate_disk_zones().<br />
However it must be called using the new table (referenced by<br />
md->zone_revalidate_map) and the new queue limits while the DM device is<br />
suspended. dm_blk_report_zones() needs some way to distinguish between a<br />
call from blk_revalidate_disk_zones(), which must be allowed to use<br />
md->zone_revalidate_map to access this not yet activated table, and all<br />
other calls to dm_blk_report_zones(), which should not be allowed while<br />
the device is suspended and cannot use md->zone_revalidate_map, since<br />
the zone resources might be freed by the process currently calling<br />
blk_revalidate_disk_zones().<br />
<br />
Solve this by tracking the process that sets md->zone_revalidate_map in<br />
dm_revalidate_zones() and only allowing that process to make use of it<br />
in dm_blk_report_zones().