]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/md/dm-integrity.c
dm integrity: test for corrupted disk format during table load
[karo-tx-linux.git] / drivers / md / dm-integrity.c
index a7a3708700c03415468192edd284bf08668d095e..3acce09bba35c54b1afe4e8af962766bfd90eb73 100644 (file)
@@ -3028,6 +3028,11 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned argc, char **argv)
                ti->error = "Block size doesn't match the information in superblock";
                goto bad;
        }
+       if (!le32_to_cpu(ic->sb->journal_sections)) {
+               r = -EINVAL;
+               ti->error = "Corrupted superblock, journal_sections is 0";
+               goto bad;
+       }
        /* make sure that ti->max_io_len doesn't overflow */
        if (ic->sb->log2_interleave_sectors < MIN_LOG2_INTERLEAVE_SECTORS ||
            ic->sb->log2_interleave_sectors > MAX_LOG2_INTERLEAVE_SECTORS) {