Skip to content

Commit f50ee8c

Browse files
keith-packardhenrikbrixandersen
authored andcommitted
fs/ext2: Missing error check in ext2_inode_remove_blocks
Don't assume that get_level_offsets will succeed. Signed-off-by: Keith Packard <keithp@keithp.com>
1 parent eb351f0 commit f50ee8c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

‎subsys/fs/ext2/ext2_diskops.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,10 @@ int64_t ext2_inode_remove_blocks(struct ext2_inode *inode, uint32_t first)
669669

670670
max_lvl = get_level_offsets(inode->i_fs, first, offsets);
671671

672+
if (max_lvl < 0) {
673+
return max_lvl;
674+
}
675+
672676
if (all_zero(&offsets[1], max_lvl)) {
673677
/* The first block to remove is either:
674678
* - one of the first 12 blocks in the indode

0 commit comments

Comments
 (0)