]> git.baikalelectronics.ru Git - kernel.git/commit
xsk: Check if a queue exists during umem setup
authorKrzysztof Kazimierczak <krzysztof.kazimierczak@intel.com>
Thu, 10 Jan 2019 19:29:02 +0000 (20:29 +0100)
committerDaniel Borkmann <daniel@iogearbox.net>
Tue, 15 Jan 2019 19:51:57 +0000 (20:51 +0100)
commit8b68c63baced510a504b42c1c727e255160c5c80
tree802382d715a03e5f6e1f20558a700df5800533a3
parentd748cbd38327b3fe3d021f2f1d72d290039b6e89
xsk: Check if a queue exists during umem setup

In the xdp_umem_assign_dev() path, the xsk code does not
check if a queue for which umem is to be created exists.
It leads to a situation where umem is not assigned to any
Tx/Rx queue of a netdevice, without notifying the stack
about an error. This affects both XDP_SKB and XDP_DRV
modes - in case of XDP_DRV_ZC, queue index is checked by
the driver.

This patch fixes xsk code, so that in both XDP_SKB and
XDP_DRV mode of AF_XDP, an error is returned when requested
queue index exceedes an existing maximum.

Fixes: 0a48449cb6440 ("xsk: fix bug when trying to use both copy and zero-copy on one queue id")
Reported-by: Jakub Spizewski <jakub.spizewski@intel.com>
Signed-off-by: Krzysztof Kazimierczak <krzysztof.kazimierczak@intel.com>
Acked-by: Björn Töpel <bjorn.topel@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
net/xdp/xdp_umem.c