Christoph Hellwig 6c6b354914 block: set the zone size in blk_revalidate_disk_zones atomically
The current zone revalidation code has a major problem in that it
doesn't update the zone size and q->nr_zones atomically, leading
to a short window where an out of bounds access to the zone arrays
is possible.

To fix this move the setting of the zone size into the crticial
sections blk_revalidate_disk_zones so that it gets updated together
with the zone bitmaps and q->nr_zones.  This also slightly simplifies
the caller as it deducts the zone size from the report_zones.

This change also allows to check for a power of two zone size in generic
code.

Reported-by: Hans Holmberg <hans@owltronix.com>
Reviewed-by: Javier González <javier@javigon.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-12-03 10:18:22 -07:00
..
2019-11-25 10:59:41 -08:00
2019-07-09 10:45:06 -07:00
2019-10-07 08:31:59 -06:00
2019-09-19 13:27:23 -07:00
2019-10-07 21:19:10 -06:00
2019-12-03 08:51:24 -07:00
2019-07-15 09:20:27 -03:00
2019-10-07 08:31:59 -06:00