From: NeilBrown Date: Mon, 2 Feb 2009 00:06:38 +0000 (+1100) Subject: Fix possible crash if bitmap metadata is bad. X-Git-Tag: mdadm-2.6.9~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b47dff6675026053dc574f305df570d79754484e;p=thirdparty%2Fmdadm.git Fix possible crash if bitmap metadata is bad. We really should never divide by 0. Thanks to "Jon Nelson" for finding the problem. Signed-off-by: NeilBrown --- diff --git a/bitmap.c b/bitmap.c index b6479392..352be5d7 100644 --- 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 --