Re: [PATCH] ext4: check if offset+length is within a valid range in fallocate

From: Tadeusz Struk
Date: Tue Mar 15 2022 - 16:39:50 EST


On 3/15/22 12:15, Tadeusz Struk wrote:
@@ -3967,6 +3968,16 @@ int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length)
offset;
}
+ /*
+ * For punch hole the length + offset needs to be at least within
+ * one block before last
+ */
+ max_length = sbi->s_bitmap_maxbytes - sbi->s_blocksize;

that supposed to be:
max_length = sbi->s_bitmap_maxbytes - inode->i_sb->s_blocksize;

Please ignore this one. I will send a new version soon.
Sorry for the noise.

+ if (offset + length >= max_length) {
+ ret = -ENOSPC;
+ goto out_mutex;
+ }
+


--
Thanks,
Tadeusz