diff mbox series

[1/1] Fix bug with RCU locking in dm_blk_report_zones().

Message ID 1605099346-3199-2-git-send-email-sergei.shtepa@veeam.com (mailing list archive)
State Accepted, archived
Delegated to: Mike Snitzer
Headers show
Series Bug with RCU locking in dm_blk_report_zones() | expand

Commit Message

Sergei Shtepa Nov. 11, 2020, 12:55 p.m. UTC
The dm_get_live_table() function makes RCU read lock and
dm_put_live_table() should call even when dm_table map was not found.

Signed-off-by: Sergei Shtepa <sergei.shtepa@veeam.com>
---
 drivers/md/dm.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index c18fc2548518..98866e725f25 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -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;