patch-2.2.0-pre2 linux/fs/fat/inode.c

Next file: linux/fs/isofs/inode.c
Previous file: linux/fs/dcache.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.0-pre1/linux/fs/fat/inode.c linux/fs/fat/inode.c
@@ -366,7 +366,9 @@
 			CF_LE_W(b->info_sector) * logical_sector_size + 0x1e0;
 		fsinfo = (struct fat_boot_fsinfo *)
 			&bh->b_data[MSDOS_SB(sb)->fsinfo_offset];
-		if (CF_LE_L(fsinfo->signature) != 0x61417272) {
+		if ((MSDOS_SB(sb)->fsinfo_offset - sizeof(MSDOS_SB(sb)->fsinfo_offset) + 1)> bh->b_size) 
+		    	printk("fat_read_super: Bad fsinfo_offset\n");
+		else if (CF_LE_L(fsinfo->signature) != 0x61417272) {
 			printk("fat_read_super: Did not find valid FSINFO "
 				"signature. Found 0x%x\n",
 				CF_LE_L(fsinfo->signature));

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov