diff options
| author | Thomas Fourier <fourier.thomas@gmail.com> | 2026-10-28 10:50:51 +0100 |
|---|---|---|
| committer | David Sterba <dsterba@suse.com> | 2026-10-30 23:17:16 +0100 |
| commit | 8c66a6aa59a5df1d672d72b7cd379d897ff73200 (patch) | |
| tree | 4d13d6f7ec94ce138b19e5f568a184e3662dab3a /tools/lib/python | |
| parent | 1960146913b31b288ed2cd607d103ee3b41681d4 (diff) | |
btrfs: zoned: fix double free of bitmaps on clone failure
btrfs_clone_dev_zone_info() duplicates the original orig_dev->zone_info
with kmemdup(), which also copies the seq_zones, empty_zones and
active_zones 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.
Fixes: 21e61ec6d0bb ("btrfs: zoned: clone zoned device info when cloning a device")
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions
