[PATCH] fs/fat/inode.c missing errorhandling

From: Martin Josefsson (gandalf@wlug.westbo.se)
Date: Thu Oct 04 2001 - 11:33:31 EST


Hi,

I found a problem with fat when I tried to mount a fat filesystem created
with 'mkdosfs -F 32 -S 8192'. I tried mounting it as vfat and I got a
panic() from set_blocksize() in fs/buffer.c

fs/fat/inode.c sets an error veriable if it detects an error but it
doesn't bail out immediately, instead it tries to pass this sectorsize to
set_blocksize() which checks if it's bigger than PAGE_SIZE and then
panics.

The solution is to bail out before set_blocksize() is called.
I checked with Al Viro on irc and he agreed.

--- linux/fs/fat/inode.c.orig Thu Oct 4 18:19:37 2001
+++ linux/fs/fat/inode.c Thu Oct 4 18:20:39 2001
@@ -712,6 +712,9 @@
         }
         brelse(bh);
 
+ if (error)
+ goto out_invalid;
+
         sb->s_blocksize = logical_sector_size;
         sb->s_blocksize_bits = ffs(logical_sector_size) - 1;
         set_blocksize(sb->s_dev, sb->s_blocksize);

/Martin

Never argue with an idiot. They drag you down to their level, then beat you with experience.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Oct 07 2001 - 21:00:32 EST