mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-31 04:01:48 -04:00
xsk: Fix out of boundary write in __xsk_rcv_memcpy
commit db5c97f02373917efe2c218ebf8e3d8b19e343b6 upstream.
first_len is the remainder of the first page we're copying.
If this size is larger, then out of page boundary write will
otherwise happen.
Fixes: c05cd36458 ("xsk: add support to allow unaligned chunk placement")
Signed-off-by: Li RongQing <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Acked-by: Jonathan Lemon <[email protected]>
Acked-by: Björn Töpel <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
9a9eae7852
commit
e7f6c25baf
1 changed files with 3 additions and 2 deletions
|
|
@ -129,8 +129,9 @@ static void __xsk_rcv_memcpy(struct xdp_umem *umem, u64 addr, void *from_buf,
|
|||
u64 page_start = addr & ~(PAGE_SIZE - 1);
|
||||
u64 first_len = PAGE_SIZE - (addr - page_start);
|
||||
|
||||
memcpy(to_buf, from_buf, first_len + metalen);
|
||||
memcpy(next_pg_addr, from_buf + first_len, len - first_len);
|
||||
memcpy(to_buf, from_buf, first_len);
|
||||
memcpy(next_pg_addr, from_buf + first_len,
|
||||
len + metalen - first_len);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue