diff options
author | Filipe Manana <fdmanana@suse.com> | 2023-10-13 10:05:48 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-11-20 11:06:57 +0100 |
commit | 4be0407ffcf6db5bf520aac6e950e9488c96456b (patch) | |
tree | efbbb06ff6b6f896fc7a52db3239565638c97b37 /scripts/Makefile.host | |
parent | 2bbbb976faa1104764ffd0474738b0ee49ce51c2 (diff) | |
download | linux-stable-4be0407ffcf6db5bf520aac6e950e9488c96456b.tar.gz linux-stable-4be0407ffcf6db5bf520aac6e950e9488c96456b.tar.bz2 linux-stable-4be0407ffcf6db5bf520aac6e950e9488c96456b.zip |
btrfs: use u64 for buffer sizes in the tree search ioctls
[ Upstream commit dec96fc2dcb59723e041416b8dc53e011b4bfc2e ]
In the tree search v2 ioctl we use the type size_t, which is an unsigned
long, to track the buffer size in the local variable 'buf_size'. An
unsigned long is 32 bits wide on a 32 bits architecture. The buffer size
defined in struct btrfs_ioctl_search_args_v2 is a u64, so when we later
try to copy the local variable 'buf_size' to the argument struct, when
the search returns -EOVERFLOW, we copy only 32 bits which will be a
problem on big endian systems.
Fix this by using a u64 type for the buffer sizes, not only at
btrfs_ioctl_tree_search_v2(), but also everywhere down the call chain
so that we can use the u64 at btrfs_ioctl_tree_search_v2().
Fixes: cc68a8a5a433 ("btrfs: new ioctl TREE_SEARCH_V2")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/linux-btrfs/ce6f4bd6-9453-4ffe-ba00-cee35495e10f@moroto.mountain/
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'scripts/Makefile.host')
0 files changed, 0 insertions, 0 deletions