2004-09-30 13:24:52

by Stephen C. Tweedie

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

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

Signed-off-by: Stephen Tweedie <[email protected]>

--- 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;
}