]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: zoned: clone zoned device info when cloning a device
authorJohannes Thumshirn <johannes.thumshirn@wdc.com>
Fri, 4 Nov 2022 14:12:33 +0000 (07:12 -0700)
committerDavid Sterba <dsterba@suse.com>
Mon, 7 Nov 2022 13:35:21 +0000 (14:35 +0100)
commit3924a91480c7437224b10ad2f42bf02f21c67c39
tree6c047347027e9a2199976de75c777eb656972583
parentb14f06a3bbffc33a3576a3cc91b03ec891795ccd
btrfs: zoned: clone zoned device info when cloning a device

When cloning a btrfs_device, we're not cloning the associated
btrfs_zoned_device_info structure of the device in case of a zoned
filesystem.

Later on this leads to a NULL pointer dereference when accessing the
device's zone_info for instance when setting a zone as active.

This was uncovered by fstests' testcase btrfs/161.

CC: stable@vger.kernel.org # 5.15+
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/volumes.c
fs/btrfs/zoned.c
fs/btrfs/zoned.h