Commit 457ae72
Btrfs: fix an integer overflow check
This isn't super serious because you need CAP_ADMIN to run this code.
I added this integer overflow check last year but apparently I am
rubbish at writing integer overflow checks... There are two issues.
First, access_ok() works on unsigned long type and not u64 so on 32 bit
systems the access_ok() could be checking a truncated size. The other
issue is that we should be using a stricter limit so we don't overflow
the kzalloc() setting ctx->clone_roots later in the function after the
access_ok():
alloc_size = sizeof(struct clone_root) * (arg->clone_sources_count + 1);
sctx->clone_roots = kzalloc(alloc_size, GFP_KERNEL | __GFP_NOWARN);
Fixes: f5ecec3 ("btrfs: send: silence an integer overflow warning")
Signed-off-by: Dan Carpenter <[email protected]>
Reviewed-by: David Sterba <[email protected]>
[ added comment ]
Signed-off-by: David Sterba <[email protected]>1 parent ce0dcee commit 457ae72
1 file changed
+6
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6305 | 6305 | | |
6306 | 6306 | | |
6307 | 6307 | | |
| 6308 | + | |
| 6309 | + | |
| 6310 | + | |
| 6311 | + | |
| 6312 | + | |
6308 | 6313 | | |
6309 | | - | |
| 6314 | + | |
6310 | 6315 | | |
6311 | 6316 | | |
6312 | 6317 | | |
| |||
0 commit comments