diff options
author | Sergei Shtepa <sergei.shtepa@veeam.com> | 2020-11-11 15:55:46 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-12-11 15:23:30 +0300 |
commit | 3b02d67064ffacd66f65d9c1064285a19b26219f (patch) | |
tree | d028354fc6e3656474f8e94bb8ee9aedd9239b25 | |
parent | 7eb514087cdda91134f7eed41a7407016e8c0483 (diff) | |
download | linux-3b02d67064ffacd66f65d9c1064285a19b26219f.tar.xz |
dm: fix bug with RCU locking in dm_blk_report_zones
commit 89478335718c98557f10470a9bc5c555b9261c4e upstream.
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: e76239a3748c9 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/md/dm.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 667db23f10ee..2744805de1a3 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -455,8 +455,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; + } tgt = dm_table_find_target(map, sector); if (!tgt) { |