blob: 7de7ab2d727d84f5fdd21a97cc04b8cffa9ed614 [file] [log] [blame]
From b388cb2f900a67c2129d0278859f14c3650b1106 Mon Sep 17 00:00:00 2001
From: Mikulas Patocka <>
Date: Mon, 17 Feb 2020 08:11:35 -0500
Subject: [PATCH] dm integrity: fix invalid table returned due to argument
count mismatch
commit 7fc2e47f40dd77ab1fcbda6db89614a0173d89c7 upstream.
If the flag SB_FLAG_RECALCULATE is present in the superblock, but it was
not specified on the command line (i.e. ic->recalculate_flag is false),
dm-integrity would return invalid table line - the reported number of
arguments would not match the real number.
Fixes: 468dfca38b1a ("dm integrity: add a bitmap mode")
Cc: # v5.2+
Reported-by: Ondrej Kozina <>
Signed-off-by: Mikulas Patocka <>
Signed-off-by: Mike Snitzer <>
Signed-off-by: Paul Gortmaker <>
diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c
index 717cf7ec48eb..5914ae5c4ba3 100644
--- a/drivers/md/dm-integrity.c
+++ b/drivers/md/dm-integrity.c
@@ -2957,7 +2957,7 @@ static void dm_integrity_status(struct dm_target *ti, status_type_t type,
DMEMIT(" meta_device:%s", ic->meta_dev->name);
if (ic->sectors_per_block != 1)
DMEMIT(" block_size:%u", ic->sectors_per_block << SECTOR_SHIFT);
- if (ic->recalculate_flag)
+ if (ic->sb->flags & cpu_to_le32(SB_FLAG_RECALCULATING))
DMEMIT(" recalculate");
DMEMIT(" journal_sectors:%u", ic->initial_sectors - SB_SECTORS);
DMEMIT(" interleave_sectors:%u", 1U << ic->sb->log2_interleave_sectors);