Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

btrfs: fix chunk map leak in btrfs_map_block() after btrfs_chunk_map_num_copies()

Fix a chunk map leak in btrfs_map_block(): if we return early with -EINVAL,
we're not freeing the chunk map that we've just looked up.

Fixes: 0ae653fbec2b ("btrfs: reduce chunk_map lookups in btrfs_map_block()")
CC: stable@vger.kernel.org # 6.12+
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Mark Harmstone <mark@harmstone.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>

authored by

Mark Harmstone and committed by
David Sterba
f15fb3d4 587bb33b

+4 -2
+4 -2
fs/btrfs/volumes.c
··· 6921 6921 } 6922 6922 6923 6923 num_copies = btrfs_chunk_map_num_copies(map); 6924 - if (io_geom.mirror_num > num_copies) 6925 - return -EINVAL; 6924 + if (io_geom.mirror_num > num_copies) { 6925 + ret = -EINVAL; 6926 + goto out; 6927 + } 6926 6928 6927 6929 map_offset = logical - map->start; 6928 6930 io_geom.raid56_full_stripe_start = (u64)-1;