summaryrefslogtreecommitdiffstats
path: root/mm/slab.h
diff options
context:
space:
mode:
authorDamien Le Moal <damien.lemoal@wdc.com>2020-11-20 10:55:11 +0900
committerJens Axboe <axboe@kernel.dk>2020-12-07 17:36:03 -0700
commit0ebcdd702f49aeb0ad2e2d894f8c124a0acc6e23 (patch)
treed9e8e7cb7f4ee648eb930889b99277ba53b0fd3a /mm/slab.h
parentdf4ad53242158f9f1f97daf4feddbb4f8b77f080 (diff)
downloadlinux-stable-0ebcdd702f49aeb0ad2e2d894f8c124a0acc6e23.tar.gz
linux-stable-0ebcdd702f49aeb0ad2e2d894f8c124a0acc6e23.tar.bz2
linux-stable-0ebcdd702f49aeb0ad2e2d894f8c124a0acc6e23.zip
null_blk: Fix zone size initialization
For a null_blk device with zoned mode enabled is currently initialized with a number of zones equal to the device capacity divided by the zone size, without considering if the device capacity is a multiple of the zone size. If the zone size is not a divisor of the capacity, the zones end up not covering the entire capacity, potentially resulting is out of bounds accesses to the zone array. Fix this by adding one last smaller zone with a size equal to the remainder of the disk capacity divided by the zone size if the capacity is not a multiple of the zone size. For such smaller last zone, the zone capacity is also checked so that it does not exceed the smaller zone size. Reported-by: Naohiro Aota <naohiro.aota@wdc.com> Fixes: ca4b2a011948 ("null_blk: add zone support") Cc: stable@vger.kernel.org Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'mm/slab.h')
0 files changed, 0 insertions, 0 deletions