David Sterba 09450e240a 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>
2023-03-03 11:40:07 +01:00
..
2022-07-02 16:27:33 +02:00
2019-08-06 19:06:51 +02:00
2021-09-22 11:48:02 +02:00
2022-08-25 11:14:55 +02:00
2022-11-25 17:40:29 +01:00
2023-02-22 12:47:19 +01:00
2022-06-14 16:59:24 +02:00
2021-05-22 10:59:50 +02:00
2023-01-18 11:30:40 +01:00
2021-12-14 10:18:07 +01:00