]> git.baikalelectronics.ru Git - kernel.git/commit
dm: don't call report zones for more than the user requested
authorJohannes Thumshirn <johannes.thumshirn@wdc.com>
Tue, 4 Aug 2020 09:25:01 +0000 (18:25 +0900)
committerMike Snitzer <snitzer@redhat.com>
Tue, 4 Aug 2020 20:31:12 +0000 (16:31 -0400)
commit05c942695d1b6bb637eaf4561f475862c8d76351
treeb654fb3bc10227350f6dd79b519b2deda5a0b83c
parente81eef828e7cec8e313aa8d3545cbfe78634409c
dm: don't call report zones for more than the user requested

Don't call report zones for more zones than the user actually requested,
otherwise this can lead to out-of-bounds accesses in the callback
functions.

Such a situation can happen if the target's ->report_zones() callback
function returns 0 because we've reached the end of the target and then
restart the report zones on the second target.

We're again calling into ->report_zones() and ultimately into the user
supplied callback function but when we're not subtracting the number of
zones already processed this may lead to out-of-bounds accesses in the
user callbacks.

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Fixes: b9fabf234348 ("block: rework zone reporting")
Cc: stable@vger.kernel.org # v5.5+
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm.c