2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

netdev-afxdp: Fix umem creation failure due to uninitialized config.

Later version of 'struct xsk_umem_config' contains additional field
'flags'.  OVS doesn't use that field passing uninitialized stack
memory to the 'xsk_umem__create()' call that could fail with
'Invalid argument' if 'flags' are non-zero or, even worse, create
umem with unexpected properties.

We need to clear the whole structure explicitly to avoid this kind
of issues.

Fixes: 0de1b42596 ("netdev-afxdp: add new netdev type for AF_XDP.")
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: William Tu <u9012063@gmail.com>
This commit is contained in:
Ilya Maximets
2019-10-09 16:17:58 +02:00
committed by William Tu
parent eab30f3851
commit ec92f8d2ff

View File

@@ -168,6 +168,7 @@ xsk_configure_umem(void *buffer, uint64_t size, int xdpmode)
umem = xzalloc(sizeof *umem);
memset(&uconfig, 0, sizeof uconfig);
uconfig.fill_size = PROD_NUM_DESCS;
uconfig.comp_size = CONS_NUM_DESCS;
uconfig.frame_size = FRAME_SIZE;