]> git.baikalelectronics.ru Git - kernel.git/commit
md/raid5: Fix sectors_to_do bitmap overflow in raid5_make_request()
authorLogan Gunthorpe <logang@deltatee.com>
Thu, 7 Jul 2022 19:15:32 +0000 (13:15 -0600)
committerJens Axboe <axboe@kernel.dk>
Tue, 2 Aug 2022 23:22:41 +0000 (17:22 -0600)
commitf4e1487d1a914fe36a2dc321eb4b212d4c25020f
treed9197ce5497c39b88174c2adc912dec16a98421d
parent901b45bd541884e6824a972ba77e66b2e7b33427
md/raid5: Fix sectors_to_do bitmap overflow in raid5_make_request()

For unaligned IO that have nearly maximum sectors, the number of stripes
will end up being one greater than the size of the bitmap. When this
happens, the last stripe in the IO will not be processed as it should
be, resulting in data corruption.

However, this is not normally seen when the backing block devices have
4K physical block sizes since the block layer will split the request
before that happens.

To fix this increase the bitmap size by one bit and ensure the full
number of stripes are checked when calling find_first_bit().

Reported-by: David Sloan <David.Sloan@eideticom.com>
Fixes: edd2404ffe7b ("md/raid5: Pivot raid5_make_request()")
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Song Liu <song@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/md/raid5.c