1
0
Fork 0

dm integrity: fix a crash if "recalculate" used without "internal_hash"

commit 2d06dfecb1 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>
5.4-rM2-2.2.x-imx-squashed
Mikulas Patocka 2021-01-20 06:02:31 -05:00 committed by Greg Kroah-Hartman
parent a03ce9cc4b
commit 42d855f06d
1 changed files with 6 additions and 0 deletions

View File

@ -4059,6 +4059,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,