diff options
author | Björn Töpel <bjorn.topel@intel.com> | 2020-05-25 10:03:59 +0200 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2020-05-26 00:06:00 +0200 |
commit | b16a87d0aef7a6be766f6618976dc5ff2c689291 (patch) | |
tree | f11fe5d40a3ad84d2fa05b301c0484282f9dbe40 /drivers/mcb/Kconfig | |
parent | d04322a0da1e86aedaa322ce933cfb8c0191d1eb (diff) |
xsk: Add overflow check for u64 division, stored into u32
The npgs member of struct xdp_umem is an u32 entity, and stores the
number of pages the UMEM consumes. The calculation of npgs
npgs = size / PAGE_SIZE
can overflow.
To avoid overflow scenarios, the division is now first stored in a
u64, and the result is verified to fit into 32b.
An alternative would be storing the npgs as a u64, however, this
wastes memory and is an unrealisticly large packet area.
Fixes: c0c77d8fb787 ("xsk: add user memory registration support sockopt")
Reported-by: "Minh Bùi Quang" <minhquangbui99@gmail.com>
Signed-off-by: Björn Töpel <bjorn.topel@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Link: https://lore.kernel.org/bpf/CACtPs=GGvV-_Yj6rbpzTVnopgi5nhMoCcTkSkYrJHGQHJWFZMQ@mail.gmail.com/
Link: https://lore.kernel.org/bpf/20200525080400.13195-1-bjorn.topel@gmail.com
Diffstat (limited to 'drivers/mcb/Kconfig')
0 files changed, 0 insertions, 0 deletions