summaryrefslogtreecommitdiffstats
path: root/drivers/md/md.h
diff options
context:
space:
mode:
authorFilipe Manana <fdmanana@suse.com>2023-10-13 10:05:48 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-11-20 10:27:35 +0100
commit33690eb1a89a8aa425646284733475823193fe00 (patch)
treedd3fc3d0864374907c7c0e600ac2ff9a103c3aa1 /drivers/md/md.h
parent53409f16746574caf0f69e38b94c1bf974f83f95 (diff)
downloadlinux-stable-33690eb1a89a8aa425646284733475823193fe00.tar.gz
linux-stable-33690eb1a89a8aa425646284733475823193fe00.tar.bz2
linux-stable-33690eb1a89a8aa425646284733475823193fe00.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 'drivers/md/md.h')
0 files changed, 0 insertions, 0 deletions