Skip to content

Commit 670ccab

Browse files
committed
fs/ext2: Missing error check in ext2_inode_remove_blocks
Don't assume that get_level_offsets will succeed. Signed-off-by: Keith Packard <[email protected]>
1 parent d94c1cf commit 670ccab

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

subsys/fs/ext2/ext2_diskops.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,9 @@ 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+
672675
if (all_zero(&offsets[1], max_lvl)) {
673676
/* The first block to remove is either:
674677
* - one of the first 12 blocks in the indode

0 commit comments

Comments
 (0)