NeilBrown: Fix possible crash if bitmap metadata is bad.

Martin F. Krafft madduck at alioth.debian.org
Mon Feb 16 10:52:46 UTC 2009


Module: mdadm
Branch: master
Commit: b47dff6675026053dc574f305df570d79754484e
URL:    http://git.debian.org/?p=pkg-mdadm/mdadm.git;a=commit;h=b47dff6675026053dc574f305df570d79754484e

Author: NeilBrown <neilb at suse.de>
Date:   Mon Feb  2 11:06:38 2009 +1100

Fix possible crash if bitmap metadata is bad.

We really should never divide by 0.

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

Signed-off-by: NeilBrown <neilb at suse.de>

---

 bitmap.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/bitmap.c b/bitmap.c
index b647939..352be5d 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 --




More information about the pkg-mdadm-commits mailing list