]> git.hungrycats.org Git - linux/commitdiff
[PATCH] Insufficient validity check of fat_read_super() <2>
authorHirofumi Ogawa <hirofumi@mail.parknet.co.jp>
Thu, 21 Feb 2002 04:23:29 +0000 (20:23 -0800)
committerLinus Torvalds <torvalds@penguin.transmeta.com>
Thu, 21 Feb 2002 04:23:29 +0000 (20:23 -0800)
This patch add the validity check of 2 values (fats, reserved). These
values must not be 0.

OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

fs/fat/inode.c

index 0b292b3562ffaccd4a9a7388217be60abf431890..73859637332d47097ed15fb59227040c4b2ef319 100644 (file)
@@ -625,6 +625,18 @@ fat_read_super(struct super_block *sb, void *data, int silent,
        }
 
        b = (struct fat_boot_sector *) bh->b_data;
+       if (!b->reserved) {
+               if (!silent)
+                       printk("FAT: bogus number of reserved sectors\n");
+               brelse(bh);
+               goto out_invalid;
+       }
+       if (!b->fats) {
+               if (!silent)
+                       printk("FAT: bogus number of FAT structure\n");
+               brelse(bh);
+               goto out_invalid;
+       }
        if (!b->secs_track) {
                if (!silent)
                        printk("FAT: bogus sectors-per-track value\n");