]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
btrfs: fix potential overflow in cluster_pages_for_defrag on 32bit arch
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Sun, 4 Oct 2020 18:04:26 +0000 (19:04 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Nov 2020 18:20:30 +0000 (19:20 +0100)
commit33e53f2cac19cc6b2f2eaebc27ff70c813a04998
treed6798ca0cdbcbb8506579de25f35c34e3401bf2f
parent9de4ffb701505624b9da5e03d3662f9dee6d28b7
btrfs: fix potential overflow in cluster_pages_for_defrag on 32bit arch

commit a1fbc6750e212c5675a4e48d7f51d44607eb8756 upstream.

On 32-bit systems, this shift will overflow for files larger than 4GB as
start_index is unsigned long while the calls to btrfs_delalloc_*_space
expect u64.

CC: stable@vger.kernel.org # 4.4+
Fixes: df480633b891 ("btrfs: extent-tree: Switch to new delalloc space reserve and release")
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: David Sterba <dsterba@suse.com>
[ define the variable instead of repeating the shift ]
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/ioctl.c