Fix error return case in ext2fs

tytso@mit.edu
Sun, 11 Oct 1998 23:25:59 -0400


Hi Linus,

While reading through the ext2fs code, I discovered a potential
problem in read_block_bitmap(). If there is an error reading the group
descriptors, read_block_bitmap() will return 0 instead of EIO. This
will cause the block allocation code to tie itself into knots because it
will think the block bitmap map has been loaded when it really hasn't
been. It was simple, stupid coding error, and the fix is equally
simple.

I'd appreciate it if you could apply the enclosed patch to the
2.1 kernel sources. Thanks!!

- Ted

Patch generated: on Sun Oct 11 10:05:41 EDT 1998 by tytso@rsts-11.mit.edu
against Linux version 2.1.125
===================================================================
RCS file: fs/ext2/RCS/balloc.c,v
retrieving revision 1.1
diff -u -r1.1 fs/ext2/balloc.c
--- fs/ext2/balloc.c 1998/10/11 14:05:06 1.1
+++ fs/ext2/balloc.c 1998/10/11 14:05:33
@@ -89,8 +89,10 @@
int retval = 0;

gdp = ext2_get_group_desc (sb, block_group, NULL);
- if (!gdp)
+ if (!gdp) {
+ retval = -EIO;
goto error_out;
+ }
bh = bread (sb->s_dev, le32_to_cpu(gdp->bg_block_bitmap), sb->s_blocksize);
if (!bh) {
ext2_error (sb, "read_block_bitmap",

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