xsk: Fix out of boundary write in __xsk_rcv_memcpy
authorLi RongQing <lirongqing@baidu.com>
Thu, 2 Apr 2020 07:52:10 +0000 (15:52 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 23 Apr 2020 08:36:15 +0000 (10:36 +0200)
commite7f6c25bafa68c3a6f085d00851503a3f3897e74
tree1c14574d0b49a349f897449d23f327eb8dc743c0
parent9a9eae78529cfd9152af417acbf09a32019605c5
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: c05cd3645814 ("xsk: add support to allow unaligned chunk placement")
Signed-off-by: Li RongQing <lirongqing@baidu.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Acked-by: Björn Töpel <bjorn.topel@intel.com>
Link: https://lore.kernel.org/bpf/1585813930-19712-1-git-send-email-lirongqing@baidu.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/xdp/xsk.c