btrfs: trim: Check the range passed into to prevent overflow
authorQu Wenruo <wqu@suse.com>
Tue, 28 May 2019 08:21:54 +0000 (16:21 +0800)
committerDavid Sterba <dsterba@suse.com>
Wed, 7 Aug 2019 14:42:39 +0000 (16:42 +0200)
commit07301df7d2fc220d3de5f7ad804dcb941400cb00
tree729e1588e6f53c4e97d9b415153b897266f328d2
parentd7cd4dd907c19c0295829c947d79afa290b6fc24
btrfs: trim: Check the range passed into to prevent overflow

Normally the range->len is set to default value (U64_MAX), but when it's
not default value, we should check if the range overflows.

And if it overflows, return -EINVAL before doing anything.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-tree.c