summaryrefslogtreecommitdiff
path: root/drivers/md/dm-integrity.c
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2021-01-20 14:02:31 +0300
committerMike Snitzer <snitzer@redhat.com>2021-01-21 22:41:43 +0300
commit2d06dfecb132a1cc2e374a44eae83b5c4356b8b4 (patch)
tree1b237ec09b83baec1bff7c3d46b5bd9fb741be19 /drivers/md/dm-integrity.c
parent19c329f6808995b142b3966301f217c831e7cf31 (diff)
downloadlinux-2d06dfecb132a1cc2e374a44eae83b5c4356b8b4.tar.xz
dm integrity: fix a crash if "recalculate" used without "internal_hash"
Recalculate can only be specified with internal_hash. Cc: stable@vger.kernel.org # v4.19+ Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm-integrity.c')
-rw-r--r--drivers/md/dm-integrity.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c
index 81df019ab284..cce203adcf77 100644
--- a/drivers/md/dm-integrity.c
+++ b/drivers/md/dm-integrity.c
@@ -4235,6 +4235,12 @@ try_smaller_buffer:
r = -ENOMEM;
goto bad;
}
+ } else {
+ if (ic->sb->flags & cpu_to_le32(SB_FLAG_RECALCULATING)) {
+ ti->error = "Recalculate can only be specified with internal_hash";
+ r = -EINVAL;
+ goto bad;
+ }
}
ic->bufio = dm_bufio_client_create(ic->meta_dev ? ic->meta_dev->bdev : ic->dev->bdev,