CVE-2026-143378: btrfs: zoned: fix double free of bitmaps on clone failure
In the Linux kernel, the following vulnerability has been resolved:
btrfs: zoned: fix double free of bitmaps on clone failure
btrfsclonedevzoneinfo() duplicates the original origdev->zoneinfo with kmemdup(), which also copies the seqzones, emptyzones and activezones pointers. The clone then replaces them one by one with fresh bitmaps. If one of the allocations fails, the error path frees all three pointers, including those not yet replaced, which still point to the bitmaps owned by the original device.
Clear the three pointers right after kmemdup() so the error path only frees what this function allocated.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
In btrfs_clone_dev_zone_info(), clear the seq_zones, empty_zones, and active_zones pointers immediately after kmemdup() so the error path only frees allocations made by this function.
Event History
Frequently Asked Questions
What conditions are required to trigger the faulty cleanup path?
A Btrfs zoned-device clone operation must begin, and allocation of one of the replacement zone bitmaps must fail after the cloned zone_info structure has copied bitmap pointers from the original device.
What data can be incorrectly freed when the failure occurs?
The cleanup path can free seq_zones, empty_zones, or active_zones pointers that have not yet been replaced. Those pointers still refer to bitmaps owned by the original device.