btrfs: Avoid possible qgroup_rsv_size overflow in btrfs_calculate_inode_block_rsv_size
qgroup_rsv_size is calculated as the product of
outstanding_extent * fs_info->nodesize. The product is calculated with
32 bit precision since both variables are defined as u32. Yet
qgroup_rsv_size expects a 64 bit result.
Avoid possible multiplication overflow by casting outstanding_extent to
u64. Such overflow would in the worst case (64K nodesize) require more
than 65536 extents, which is quite large and i'ts not likely that it
would happen in practice.
Fixes: ff6bc37eb7f6 ("btrfs: qgroup: Use independent and accurate per inode qgroup rsv")
CC: email@example.com # 4.19+
Reviewed-by: Qu Wenruo <firstname.lastname@example.org>
Signed-off-by: Nikolay Borisov <email@example.com>
Reviewed-by: David Sterba <firstname.lastname@example.org>
Signed-off-by: David Sterba <email@example.com>
1 file changed