]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Fix possible crash if bitmap metadata is bad.
authorNeilBrown <neilb@suse.de>
Mon, 2 Feb 2009 00:06:38 +0000 (11:06 +1100)
committerNeilBrown <neilb@suse.de>
Mon, 2 Feb 2009 00:06:38 +0000 (11:06 +1100)
We really should never divide by 0.

Thanks to "Jon Nelson" <jnelson-linux-raid@jamponi.net>
for finding the problem.

Signed-off-by: NeilBrown <neilb@suse.de>
bitmap.c

index b64793924bd04c01e870e147f359af05468f5e9a..352be5d7261a7e130ad900bbbf3d2ff1b5128c34 100644 (file)
--- a/bitmap.c
+++ b/bitmap.c
@@ -162,7 +162,7 @@ bitmap_info_t *bitmap_fd_read(int fd, int brief)
 
        sb_le_to_cpu(&info->sb); /* convert superblock to CPU byte ordering */
 
-       if (brief || info->sb.sync_size == 0)
+       if (brief || info->sb.sync_size == 0 || info->sb.chunksize == 0)
                goto out;
 
        /* read the rest of the file counting total bits and dirty bits --