Commit 75ca6ad
ext4: fix loff_t overflow in ext4_max_bitmap_size()
We should use unsigned long long rather than loff_t to avoid
overflow in ext4_max_bitmap_size() for comparison before returning.
w/o this patch sbi->s_bitmap_maxbytes was becoming a negative
value due to overflow of upper_limit (with has_huge_files as true)
Below is a quick test to trigger it on a 64KB pagesize system.
sudo mkfs.ext4 -b 65536 -O ^has_extents,^64bit /dev/loop2
sudo mount /dev/loop2 /mnt
sudo echo "hello" > /mnt/hello -> This will error out with
"echo: write error: File too large"
Signed-off-by: Ritesh Harjani <[email protected]>
Reviewed-by: Jan Kara <[email protected]>
Signed-off-by: Theodore Ts'o <[email protected]>
Cc: [email protected]
Link: https://lore.kernel.org/r/594f409e2c543e90fd836b78188dfa5c575065ba.1622867594.git.riteshh@linux.ibm.com
Signed-off-by: Theodore Ts'o <[email protected]>1 parent 6fed839 commit 75ca6ad
1 file changed
+5
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3030 | 3030 | | |
3031 | 3031 | | |
3032 | 3032 | | |
3033 | | - | |
| 3033 | + | |
3034 | 3034 | | |
3035 | | - | |
3036 | | - | |
| 3035 | + | |
| 3036 | + | |
| 3037 | + | |
3037 | 3038 | | |
3038 | 3039 | | |
3039 | 3040 | | |
3040 | 3041 | | |
3041 | 3042 | | |
3042 | 3043 | | |
3043 | | - | |
3044 | 3044 | | |
3045 | 3045 | | |
3046 | 3046 | | |
| |||
3083 | 3083 | | |
3084 | 3084 | | |
3085 | 3085 | | |
3086 | | - | |
| 3086 | + | |
3087 | 3087 | | |
3088 | 3088 | | |
3089 | 3089 | | |
| |||
0 commit comments