summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorDamien Le Moal <dlemoal@kernel.org>2024-11-07 15:42:59 +0900
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-12-14 20:03:35 +0100
commit493326c4f10cc71a42c27fdc97ce112182ee4cbc (patch)
tree545d7f4c35a96d8889b53736aa61762787bc522f /include/linux
parentbe54e6e0f93a39a9c00478d70d12956a5f3d5b9b (diff)
downloadlinux-493326c4f10cc71a42c27fdc97ce112182ee4cbc.tar.gz
linux-493326c4f10cc71a42c27fdc97ce112182ee4cbc.tar.bz2
linux-493326c4f10cc71a42c27fdc97ce112182ee4cbc.zip
block: RCU protect disk->conv_zones_bitmap
[ Upstream commit d7cb6d7414ea1b33536fa6d11805cb8dceec1f97 ] Ensure that a disk revalidation changing the conventional zones bitmap of a disk does not cause invalid memory references when using the disk_zone_is_conv() helper by RCU protecting the disk->conv_zones_bitmap pointer. disk_zone_is_conv() is modified to operate under the RCU read lock and the function disk_set_conv_zones_bitmap() is added to update a disk conv_zones_bitmap pointer using rcu_replace_pointer() with the disk zone_wplugs_lock spinlock held. disk_free_zone_resources() is modified to call disk_update_zone_resources() with a NULL bitmap pointer to free the disk conv_zones_bitmap. disk_set_conv_zones_bitmap() is also used in disk_update_zone_resources() to set the new (revalidated) bitmap and free the old one. Signed-off-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Link: https://lore.kernel.org/r/20241107064300.227731-2-dlemoal@kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/blkdev.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index e84a93c40132..6b4bc85f4999 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -195,7 +195,7 @@ struct gendisk {
unsigned int nr_zones;
unsigned int zone_capacity;
unsigned int last_zone_capacity;
- unsigned long *conv_zones_bitmap;
+ unsigned long __rcu *conv_zones_bitmap;
unsigned int zone_wplugs_hash_bits;
spinlock_t zone_wplugs_lock;
struct mempool_s *zone_wplugs_pool;