Hou Tao a2c2f0826e ext4: limit the number of blocks in one ADD_RANGE TLV
Now EXT4_FC_TAG_ADD_RANGE uses ext4_extent to track the
newly-added blocks, but the limit on the max value of
ee_len field is ignored, and it can lead to BUG_ON as
shown below when running command "fallocate -l 128M file"
on a fast_commit-enabled fs:

  kernel BUG at fs/ext4/ext4_extents.h:199!
  invalid opcode: 0000 [#1] SMP PTI
  CPU: 3 PID: 624 Comm: fallocate Not tainted 5.14.0-rc6+ #1
  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996)
  RIP: 0010:ext4_fc_write_inode_data+0x1f3/0x200
  Call Trace:
   ? ext4_fc_write_inode+0xf2/0x150
   ext4_fc_commit+0x93b/0xa00
   ? ext4_fallocate+0x1ad/0x10d0
   ext4_sync_file+0x157/0x340
   ? ext4_sync_file+0x157/0x340
   vfs_fsync_range+0x49/0x80
   do_fsync+0x3d/0x70
   __x64_sys_fsync+0x14/0x20
   do_syscall_64+0x3b/0xc0
   entry_SYSCALL_64_after_hwframe+0x44/0xae

Simply fixing it by limiting the number of blocks
in one EXT4_FC_TAG_ADD_RANGE TLV.

Fixes: aa75f4d3daae ("ext4: main fast-commit commit path")
Cc: stable@kernel.org
Signed-off-by: Hou Tao <houtao1@huawei.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Link: https://lore.kernel.org/r/20210820044505.474318-1-houtao1@huawei.com
2021-10-01 00:03:25 -04:00
..
2021-05-07 11:18:52 -07:00
2021-06-25 09:41:29 -07:00
2021-03-30 16:54:49 -07:00
2021-07-13 12:02:07 -07:00
2021-06-14 09:07:45 +02:00
2021-04-12 15:04:29 +02:00
2021-07-06 11:06:04 -07:00
2021-06-29 10:53:48 -07:00
2021-07-06 11:17:41 -07:00
2021-07-02 14:25:17 -07:00
2021-07-05 13:51:41 -07:00
2021-07-09 09:43:57 -07:00
2021-07-06 20:14:41 -04:00
2021-07-09 12:05:33 -07:00
2021-04-30 15:17:08 -07:00
2021-06-30 12:21:16 -07:00
2021-06-29 10:53:48 -07:00
\n
2021-07-01 12:06:39 -07:00
\n
2021-07-01 12:06:39 -07:00
2021-07-18 11:27:25 -07:00
2021-01-24 14:27:20 +01:00
2021-01-24 14:27:20 +01:00
2021-05-18 20:15:58 -04:00
\n
2021-07-01 12:06:39 -07:00
2021-01-24 14:27:19 +01:00
2021-07-11 16:39:06 -06:00
2021-06-18 09:22:02 -06:00
2021-04-12 15:04:23 +02:00
2021-06-29 10:53:48 -07:00
2021-02-24 13:38:26 -08:00
2021-01-24 14:27:20 +01:00
2021-01-24 14:27:19 +01:00
2021-02-21 11:02:48 -08:00
2021-02-13 17:17:53 +01:00
2021-06-01 07:44:32 -06:00
2021-01-24 14:27:18 +01:00