Commit 33e17b3
committed
btrfs: send: limit number of clones and allocated memory size
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: [email protected]
Signed-off-by: David Sterba <[email protected]>1 parent eadd7de commit 33e17b3
1 file changed
+3
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8072 | 8072 | | |
8073 | 8073 | | |
8074 | 8074 | | |
8075 | | - | |
| 8075 | + | |
| 8076 | + | |
8076 | 8077 | | |
8077 | | - | |
8078 | | - | |
| 8078 | + | |
8079 | 8079 | | |
8080 | 8080 | | |
8081 | 8081 | | |
| |||
0 commit comments