dm: fix bug with RCU locking in dm_blk_report_zones

The dm_get_live_table() function makes RCU read lock so
dm_put_live_table() must be called even if dm_table map is not found.

Fixes: e76239a374 ("block: add a report_zones method")
Cc: stable@vger.kernel.org
Signed-off-by: Sergei Shtepa <sergei.shtepa@veeam.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
This commit is contained in:
Sergei Shtepa 2020-11-11 15:55:46 +03:00 committed by Mike Snitzer
parent 35d2835d2a
commit 8947833571
1 changed files with 4 additions and 2 deletions

View File

@ -476,8 +476,10 @@ static int dm_blk_report_zones(struct gendisk *disk, sector_t sector,
return -EAGAIN; return -EAGAIN;
map = dm_get_live_table(md, &srcu_idx); map = dm_get_live_table(md, &srcu_idx);
if (!map) if (!map) {
return -EIO; ret = -EIO;
goto out;
}
do { do {
struct dm_target *tgt; struct dm_target *tgt;