[Patch 3/10]: ext3 online resize: fix bh leak

From: Stephen Tweedie
Date: Thu Sep 30 2004 - 08:28:41 EST


Make sure that verify_group_input() brelse's the buffer we're verifying
in every case.

Signed-off-by: Stephen Tweedie <sct@xxxxxxxxxx>

--- linux-2.6.9-rc2-mm4/fs/ext3/resize.c.=K0002=.orig
+++ linux-2.6.9-rc2-mm4/fs/ext3/resize.c
@@ -36,7 +36,7 @@ static int verify_group_input(struct sup
(1 + ext3_bg_num_gdb(sb, group) +
le16_to_cpu(es->s_reserved_gdt_blocks)) : 0;
unsigned metaend = start + overhead;
- struct buffer_head *bh;
+ struct buffer_head *bh = NULL;
int free_blocks_count;
int err = -EINVAL;

@@ -104,10 +104,9 @@ static int verify_group_input(struct sup
ext3_warning(sb, __FUNCTION__,
"Inode table (%u-%u) overlaps GDT table (%u-%u)",
input->inode_table, itend - 1, start, metaend - 1);
- else {
- brelse(bh);
+ else
err = 0;
- }
+ brelse(bh);

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