summaryrefslogtreecommitdiff
path: root/drivers/md
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2021-01-20 14:02:31 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-01-27 13:05:36 +0300
commitcf750e09d17f25cf763644168417fcad73e3ce0c (patch)
tree5337317f33714c61a0c189bdcfe925fae0053308 /drivers/md
parent97c5846e04532a0651da7016b4d35862993ea56d (diff)
downloadlinux-cf750e09d17f25cf763644168417fcad73e3ce0c.tar.xz
dm integrity: fix a crash if "recalculate" used without "internal_hash"
commit 2d06dfecb132a1cc2e374a44eae83b5c4356b8b4 upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/md')
-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 bb99b599de77..1917051b512f 100644
--- a/drivers/md/dm-integrity.c
+++ b/drivers/md/dm-integrity.c
@@ -3515,6 +3515,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,