diff options
author | David Sterba <dsterba@suse.com> | 2023-01-24 20:32:10 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-03-03 11:40:07 +0100 |
commit | 09450e240a7a3de7cd0fbac13ce512dc2618d863 (patch) | |
tree | c9aca72372141a1905f3af598d12d1d095106e1f /drivers/infiniband/hw | |
parent | 5f8401d7dba21e549306fe4a7a9ff8bf3bd8d56a (diff) | |
download | linux-stable-09450e240a7a3de7cd0fbac13ce512dc2618d863.tar.gz linux-stable-09450e240a7a3de7cd0fbac13ce512dc2618d863.tar.bz2 linux-stable-09450e240a7a3de7cd0fbac13ce512dc2618d863.zip |
btrfs: send: limit number of clones and allocated memory size
[ Upstream commit 33e17b3f5ab74af12aca58c515bc8424ff69a343 ]
The arg->clone_sources_count is u64 and can trigger a warning when a
huge value is passed from user space and a huge array is allocated.
Limit the allocated memory to 8MiB (can be increased if needed), which
in turn limits the number of clone sources to 8M / sizeof(struct
clone_root) = 8M / 40 = 209715. Real world number of clones is from
tens to hundreds, so this is future proof.
Reported-by: syzbot+4376a9a073770c173269@syzkaller.appspotmail.com
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/infiniband/hw')
0 files changed, 0 insertions, 0 deletions