Skip to content

Commit 7f0adae

Browse files
kvaneeshLinus Torvalds
authored andcommitted
ext2: return after ext2_error in case of failures
This fixes some instances where we were continuing after calling ext2_error. ext2_error call panic only if errors=panic mount option is set. So we need to make sure we return correctly after ext2_error call. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 73de76a commit 7f0adae

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

fs/ext2/balloc.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,11 +474,13 @@ void ext2_free_blocks (struct inode * inode, unsigned long block,
474474
in_range (block, le32_to_cpu(desc->bg_inode_table),
475475
sbi->s_itb_per_group) ||
476476
in_range (block + count - 1, le32_to_cpu(desc->bg_inode_table),
477-
sbi->s_itb_per_group))
477+
sbi->s_itb_per_group)) {
478478
ext2_error (sb, "ext2_free_blocks",
479479
"Freeing blocks in system zones - "
480480
"Block = %lu, count = %lu",
481481
block, count);
482+
goto error_return;
483+
}
482484

483485
for (i = 0, group_freed = 0; i < count; i++) {
484486
if (!ext2_clear_bit_atomic(sb_bgl_lock(sbi, block_group),
@@ -1311,11 +1313,13 @@ ext2_fsblk_t ext2_new_blocks(struct inode *inode, ext2_fsblk_t goal,
13111313
in_range(ret_block, le32_to_cpu(gdp->bg_inode_table),
13121314
EXT2_SB(sb)->s_itb_per_group) ||
13131315
in_range(ret_block + num - 1, le32_to_cpu(gdp->bg_inode_table),
1314-
EXT2_SB(sb)->s_itb_per_group))
1316+
EXT2_SB(sb)->s_itb_per_group)) {
13151317
ext2_error(sb, "ext2_new_blocks",
13161318
"Allocating block in system zone - "
13171319
"blocks from "E2FSBLK", length %lu",
13181320
ret_block, num);
1321+
goto out;
1322+
}
13191323

13201324
performed_allocation = 1;
13211325

0 commit comments

Comments
 (0)