Skip to content

Commit

Permalink
dm: fix bug with RCU locking in dm_blk_report_zones
Browse files Browse the repository at this point in the history
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: e76239a ("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>
  • Loading branch information
Sergei Shtepa authored and Mike Snitzer committed Dec 1, 2020
1 parent 35d2835 commit 8947833
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/md/dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,10 @@ static int dm_blk_report_zones(struct gendisk *disk, sector_t sector,
return -EAGAIN;

map = dm_get_live_table(md, &srcu_idx);
if (!map)
return -EIO;
if (!map) {
ret = -EIO;
goto out;
}

do {
struct dm_target *tgt;
Expand Down

0 comments on commit 8947833

Please sign in to comment.