Commit f50ee8c1 authored by Keith Packard's avatar Keith Packard Committed by Henrik Brix Andersen
Browse files

fs/ext2: Missing error check in ext2_inode_remove_blocks



Don't assume that get_level_offsets will succeed.

Signed-off-by: default avatarKeith Packard <keithp@keithp.com>
parent eb351f05
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -669,6 +669,10 @@ int64_t ext2_inode_remove_blocks(struct ext2_inode *inode, uint32_t first)

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

	if (max_lvl < 0) {
		return max_lvl;
	}

	if (all_zero(&offsets[1], max_lvl)) {
		/* The first block to remove is either:
		 *  - one of the first 12 blocks in the indode